Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Qinyuan Wan committed Dec 13, 2016
1 parent 6d97240 commit b67fe25
Show file tree
Hide file tree
Showing 49 changed files with 3,338 additions and 514 deletions.
98 changes: 75 additions & 23 deletions lib/services/cdnManagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var standardCreateParameters = {
}
};

client.profiles.create("your-profile-name", standardCreateParameters, "your-resource-group-name", function(err, result, request, response) {
client.profiles.create("your-resource-group-name", "your-profile-name", standardCreateParameters, function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -82,8 +82,18 @@ client.profiles.create("your-profile-name", standardCreateParameters, "your-reso
}
});

//Get profile resource usage
client.profiles.listResourceUsage("your-resource-group-name", "your-profile-name", function(err, result, request, response) {
if (err) {
console.log(err);
} else {
var usages = result;
console.log(usages);
}
});

//Delete profile
client.profiles.deleteIfExists("your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.profiles.deleteIfExists("your-resource-group-name", "your-profile-name", function(err, result, request, response) {
if (err) {
console.log(err);
}
Expand All @@ -96,7 +106,7 @@ var tags = {
tag3: 'val3'
};

client.profiles.update("your-profile-name", "your-resource-group-name", tags, function(err, result, request, response) {
client.profiles.update("your-resource-group-name", "your-profile-name", tags, function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -108,7 +118,7 @@ client.profiles.update("your-profile-name", "your-resource-group-name", tags, fu
});

//Generate sso uri
client.profiles.generateSsoUri("your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.profiles.generateSsoUri("your-resource-group-name", "your-profile-name", function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -120,7 +130,7 @@ client.profiles.generateSsoUri("your-profile-name", "your-resource-group-name",
### Endpoint operations
```javascript
//List endpoint by profile
client.endpoints.listByProfile("your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.listByProfile("your-resource-group-name", "your-profile-name", function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -138,10 +148,19 @@ var endpointProperties = {
origins: [{
name: 'newname',
hostName: 'newname.azure.com'
}]
}],
geoFilters : [
{
"relativePath": "/mycar",
"action": "Allow",
"countryCodes": [
"DZ"
]
}
]
}

client.endpoints.create("your-endpoint-name", validEndpointProperties, "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.create("your-resource-group-name", "your-profile-name", "your-endpoint-name", endpointProperties, function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -150,6 +169,16 @@ client.endpoints.create("your-endpoint-name", validEndpointProperties, "your-pro
}
});

//Get endpoint resource usage
client.endpoints.listResourceUsage("your-resource-group-name", "your-profile-name", "your-endpoint-name", function(err, result, request, response) {
if (err) {
console.log(err);
} else {
var usages = result;
console.log(usages);
}
});

//Update endpoint
var newEndpointProperties = {
location: 'West US',
Expand All @@ -159,7 +188,7 @@ var newEndpointProperties = {
}
}

client.endpoints.update("your-endpoint-name", newEndpointProperties, "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.update("your-resource-group-name", "your-profile-name", "your-endpoint-name", newEndpointProperties, function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -169,7 +198,7 @@ client.endpoints.update("your-endpoint-name", newEndpointProperties, "your-profi
});

//Get Endpoint
client.endpoints.get("your-endpoint-name", "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.get("your-resource-group-name", "your-profile-name", "your-endpoint-name", function(err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -184,7 +213,7 @@ var purgeContentPaths = [
'/pictures/pic1.jpg'
]

client.endpoints.purgeContent("your-endpoint-name", "your-profile-name", "your-resource-group-name", purgeContentPaths, function(err, result, request, response) {
client.endpoints.purgeContent("your-resource-group-name", "your-profile-name", "your-endpoint-name", purgeContentPaths, function(err, result, request, response) {
if (err) {
console.log(err);
}
Expand All @@ -196,28 +225,28 @@ var loadContentPaths = [
'/pictures/pic1.jpg'
]

client.endpoints.loadContent("your-endpoint-name", "your-profile-name", "your-resource-group-name", loadContentPaths, function(err, result, request, response) {
client.endpoints.loadContent("your-resource-group-name", "your-profile-name", "your-endpoint-name", loadContentPaths, function(err, result, request, response) {
if (err) {
console.log(err);
}
});

//Stop
client.endpoints.stop("your-endpoint-name", "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.stop("your-resource-group-name", "your-profile-name", "your-endpoint-name", function(err, result, request, response) {
if (err) {
console.log(err);
}
});

//Start
client.endpoints.start("your-endpoint-name", "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.start("your-resource-group-name", "your-profile-name", "your-endpoint-name", function(err, result, request, response) {
if (err) {
console.log(err);
}
});

//Validate custom domain
client.endpoints.validateCustomDomain("your-endpoint-name", "your-profile-name", "your-resource-group-name", "your-hostName.whatever.com", function (err, result, request, response) {
client.endpoints.validateCustomDomain("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-hostName.whatever.com", function (err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -226,7 +255,7 @@ client.endpoints.validateCustomDomain("your-endpoint-name", "your-profile-name",
});

//Delete endpoint
client.endpoints.deleteIfExists("your-endpoint-name", "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.endpoints.deleteIfExists("your-resource-group-name", "your-profile-name", "your-endpoint-name", function(err, result, request, response) {
if (err) {
console.log(err);
}
Expand All @@ -236,7 +265,7 @@ client.endpoints.deleteIfExists("your-endpoint-name", "your-profile-name", "your
### Origin operations
```javascript
//List Origins
client.origins.listByEndpoint("your-endpoint-name", "your-profile-name", "your-resource-group-name", function (err, result, request, response) {
client.origins.listByEndpoint("your-resource-group-name", "your-profile-name", "your-endpoint-name", function (err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -246,7 +275,7 @@ client.origins.listByEndpoint("your-endpoint-name", "your-profile-name", "your-r
});

//Get origin
client.origins.get("your-origin-name", "your-endpoint-name", "your-profile-name", "your-resource-group-name", function (err, result, request, response) {
client.origins.get("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-origin-name", function (err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -261,14 +290,14 @@ var updateParameters = {
httpPort: 9874,
httpsPort: 9090
}
client.origins.update("your-origin-name", updateParameters, "your-endpoint-name", "your-profile-name", "your-resource-group-name", function(err, result, request, response) {
client.origins.update("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-origin-name", updateParameters, function(err, result, request, response) {
if (err) {
console.log(err);
}
}

//Delete origin
client.origins.deleteIfExists("your-origin-name", "your-endpoint-name", "your-profile-name", "your-resource-group-name", function (err, result, request, response) {
client.origins.deleteIfExists("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-origin-name", function (err, result, request, response) {
if (err) {
console.log(err);
}
Expand All @@ -278,7 +307,7 @@ client.origins.deleteIfExists("your-origin-name", "your-endpoint-name", "your-pr
### Custom domain operations
```javascript
//List custom domain by endpoint
client.customDomains.listByEndpoint("your-endpoint-name", "your-profile-name", "your-resource-group-name", function (err, result, request, response) {
client.customDomains.listByEndpoint("your-resource-group-name", "your-profile-name", "your-endpoint-name", function (err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -288,14 +317,14 @@ client.customDomains.listByEndpoint("your-endpoint-name", "your-profile-name", "
});

//Create custom domain
client.customDomains.create("your-custom-domain-name", "your-endpoint-name", "your-profile-name", "your-resource-group-name", "customdomainhostname.hello.com", function (err, result, request, response) {
client.customDomains.create("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-custom-domain-name", "customdomainhostname.hello.com", function (err, result, request, response) {
if (err) {
console.log(err);
}
});

//Get custom domain
client.customDomains.get("your-custom-domain-name", "your-endpoint-name", "your-profile-name", "your-resource-group-name", function (err, result, request, response) {
client.customDomains.get("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-custom-domain-name", function (err, result, request, response) {
if (err) {
console.log(err);
} else {
Expand All @@ -305,7 +334,7 @@ client.customDomains.get("your-custom-domain-name", "your-endpoint-name", "your-
});

//Delete custom domain
client.customDomains.deleteIfExists("your-custom-domain-name", "your-endpoint-name", "your-profile-name", "your-resource-group-name", function (err, result, request, response) {
client.customDomains.deleteIfExists("your-resource-group-name", "your-profile-name", "your-endpoint-name", "your-custom-domain-name", function (err, result, request, response) {
if (err) {
console.log(err);
}
Expand Down Expand Up @@ -334,6 +363,29 @@ client.operations.list(function(err, result, request, response) {
});
```
### List edge nodes of Azure CDN
```javascript
client.edgeNodes.list(function(err, result, request, response) {
if (err) {
console.log(err);
} else {
...
}
});
```
### Get resource usage of subscription
```javascript
client.checkResourceUsage(function(err, result, request, response) {
if (err) {
console.log(err);
} else {
console.log(result);
...
}
});
```
## Related Projects
- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
Expand Down
39 changes: 36 additions & 3 deletions lib/services/cdnManagement/lib/cdnManagementClient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ declare class CdnManagementClient {
endpoints: operations.Endpoints;
origins: operations.Origins;
customDomains: operations.CustomDomains;
edgeNodes: operations.EdgeNodes;

/**
* Check the availability of a resource name without creating the resource.
* This is needed for resources where name is globally unique, such as a CDN
* endpoint.
* Check the availability of a resource name. This is needed for resources
* where name is globally unique, such as a CDN endpoint.
*
* @param {string} name The resource name to validate.
*
Expand All @@ -80,6 +80,21 @@ declare class CdnManagementClient {
checkNameAvailability(name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.CheckNameAvailabilityOutput>): void;
checkNameAvailability(name: string, callback: ServiceCallback<models.CheckNameAvailabilityOutput>): void;

/**
* Check the quota and actual usage of the CDN profiles under the given
* subscription.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {ServiceCallback} [callback] callback function; see ServiceCallback
* doc in ms-rest index.d.ts for details
*/
checkResourceUsage(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ResourceUsageListResult>): void;
checkResourceUsage(callback: ServiceCallback<models.ResourceUsageListResult>): void;

/**
* Lists all of the available CDN REST API operations.
*
Expand All @@ -94,6 +109,24 @@ declare class CdnManagementClient {
listOperations(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.OperationListResult>): void;
listOperations(callback: ServiceCallback<models.OperationListResult>): void;

/**
* Check the quota and actual usage of the CDN profiles under the given
* subscription.
*
* @param {string} nextPageLink The NextLink from the previous successful call
* to List operation.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {ServiceCallback} [callback] callback function; see ServiceCallback
* doc in ms-rest index.d.ts for details
*/
checkResourceUsageNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ResourceUsageListResult>): void;
checkResourceUsageNext(nextPageLink: string, callback: ServiceCallback<models.ResourceUsageListResult>): void;

/**
* Lists all of the available CDN REST API operations.
*
Expand Down
Loading

0 comments on commit b67fe25

Please sign in to comment.