Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sdk/cdn/arm-cdn/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "82fdf284eea880a8e027c354911a814999a77178",
"commit": "1278b951080f769d400bb5d03090de8bc21dc355",
"readme": "specification/cdn/resource-manager/readme.md",
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\cdn\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.17 --generate-sample=true",
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/cdn/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.0",
"use": "@autorest/typescript@6.0.0-beta.17"
"release_tool": "@azure-tools/js-sdk-release-tools@2.3.0",
"use": "@autorest/typescript@6.0.0-alpha.19.20220425.1"
}
26 changes: 10 additions & 16 deletions sdk/cdn/arm-cdn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for CdnManagementClient.",
"version": "7.0.1",
"version": "7.0.2",
"engines": {
"node": ">=12.0.0"
},
"dependencies": {
"@azure/core-lro": "^2.2.0",
"@azure/abort-controller": "^1.0.0",
"@azure/core-paging": "^1.2.0",
"@azure/core-client": "^1.0.0",
"@azure/core-client": "^1.5.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/core-rest-pipeline": "^1.8.0",
"tslib": "^2.2.0"
},
"keywords": [
Expand All @@ -40,9 +40,11 @@
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^1.0.0",
"@azure-tools/test-recorder": "^2.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^7.1.1",
"cross-env": "^7.0.2"
"cross-env": "^7.0.2",
"@azure/dev-tool": "^1.0.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cdn/arm-cdn",
"repository": {
Expand Down Expand Up @@ -93,7 +95,7 @@
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped",
"docs": "echo skipped"
},
Expand All @@ -106,13 +108,5 @@
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-cdn?view=azure-node-preview"
}
}
"autoPublish": true
}
60 changes: 59 additions & 1 deletion sdk/cdn/arm-cdn/src/cdnManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
*/

import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import {
PipelineRequest,
PipelineResponse,
SendRequest
} from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import {
AfdProfilesImpl,
Expand Down Expand Up @@ -105,7 +111,7 @@ export class CdnManagementClient extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-cdn/7.0.1`;
const packageDetails = `azsdk-js-arm-cdn/7.0.2`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand All @@ -124,6 +130,29 @@ export class CdnManagementClient extends coreClient.ServiceClient {
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
};
super(optionsWithDefaults);

if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName
);
if (!bearerTokenAuthenticationPolicyFound) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
scopes: `${optionsWithDefaults.baseUri}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge
}
})
);
}
}
// Parameter assignments
this.subscriptionId = subscriptionId;

Expand Down Expand Up @@ -152,6 +181,35 @@ export class CdnManagementClient extends coreClient.ServiceClient {
this.edgeNodes = new EdgeNodesImpl(this);
this.policies = new PoliciesImpl(this);
this.managedRuleSets = new ManagedRuleSetsImpl(this);
this.addCustomApiVersionPolicy(options.apiVersion);
}

/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
private addCustomApiVersionPolicy(apiVersion?: string) {
if (!apiVersion) {
return;
}
const apiVersionPolicy = {
name: "CustomApiVersionPolicy",
async sendRequest(
request: PipelineRequest,
next: SendRequest
): Promise<PipelineResponse> {
const param = request.url.split("?");
if (param.length > 1) {
const newParams = param[1].split("&").map((item) => {
if (item.indexOf("api-version") > -1) {
return item.replace(/(?<==).*$/, apiVersion);
} else {
return item;
}
});
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
}
};
this.pipeline.addPolicy(apiVersionPolicy);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions sdk/cdn/arm-cdn/src/operations/afdEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class AfdEndpointsImpl implements AfdEndpoints {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor endpoint under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down Expand Up @@ -651,7 +651,7 @@ export class AfdEndpointsImpl implements AfdEndpoints {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor endpoint under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand All @@ -671,7 +671,8 @@ export class AfdEndpointsImpl implements AfdEndpoints {
}

/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This api
* isn't work for apex domain.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down
6 changes: 4 additions & 2 deletions sdk/cdn/arm-cdn/src/operations/afdOriginGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ export class AfdOriginGroupsImpl implements AfdOriginGroups {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor origin group under the given CDN
* profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down Expand Up @@ -536,7 +537,8 @@ export class AfdOriginGroupsImpl implements AfdOriginGroups {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor origin group under the given CDN
* profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down
6 changes: 3 additions & 3 deletions sdk/cdn/arm-cdn/src/operations/afdProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class AfdProfilesImpl implements AfdProfiles {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of AzureFrontDoor endpoints under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile
* which is unique within the resource group.
Expand Down Expand Up @@ -109,7 +109,7 @@ export class AfdProfilesImpl implements AfdProfiles {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of AzureFrontDoor endpoints under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile
* which is unique within the resource group.
Expand All @@ -127,7 +127,7 @@ export class AfdProfilesImpl implements AfdProfiles {
}

/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
* Check the name availability of a host name.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile
* which is unique within the resource group.
Expand Down
86 changes: 9 additions & 77 deletions sdk/cdn/arm-cdn/src/operations/customDomains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { CustomDomains } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Models from "../models";
import * as Parameters from "../models/parameters";
import { CdnManagementClient } from "../cdnManagementClient";
import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
Expand All @@ -32,8 +31,6 @@ import {
CustomDomainsEnableCustomHttpsResponse,
CustomDomainsListByEndpointNextResponse
} from "../models";
import { ProfilesImpl } from "./profiles";
import { type } from "os";

/// <reference lib="esnext.asynciterable" />
/** Class containing CustomDomains operations. */
Expand Down Expand Up @@ -423,37 +420,16 @@ export class CustomDomainsImpl implements CustomDomains {
customDomainName: string,
options?: CustomDomainsEnableCustomHttpsOptionalParams
): Promise<CustomDomainsEnableCustomHttpsResponse> {
// #region Added default values to add backwards compatibility
let newOptions: Models.CustomDomainsEnableCustomHttpsOptionalParams = {};
newOptions = options as Models.CustomDomainsEnableCustomHttpsOptionalParams;

if (!newOptions) {
newOptions = {};
}

let optionsPreparationPromise = Promise.resolve(options);

if (!newOptions.customDomainHttpsParameters) {
let profiles = new ProfilesImpl(this.client);
optionsPreparationPromise = profiles.get(resourceGroupName, profileName).then(profile => {
newOptions.customDomainHttpsParameters = getDefaultCustomDomainHttpsParameters(profile);
return newOptions;
})
}

return optionsPreparationPromise.then(options =>
this.client.sendOperationRequest(
{
resourceGroupName,
profileName,
endpointName,
customDomainName,
options
},
enableCustomHttpsOperationSpec
)
return this.client.sendOperationRequest(
{
resourceGroupName,
profileName,
endpointName,
customDomainName,
options
},
enableCustomHttpsOperationSpec
);
// #endregion
}

/**
Expand All @@ -477,50 +453,6 @@ export class CustomDomainsImpl implements CustomDomains {
);
}
}

// #region Added default values to add backwards compatibility
class SkuNames {
public static get standard_microsoft() { return "Standard_Microsoft"; }
public static get standard_verizon() { return "Standard_Verizon"; }
public static get standard_akamai() { return "Standard_Akamai"; }
}

function getDefaultCustomDomainHttpsParameters(profile: Models.Profile): Models.CdnManagedHttpsParameters | undefined {
switch (profile.sku.name) {
case SkuNames.standard_microsoft:
return {
certificateSource: "Cdn",
certificateSourceParameters: {
certificateType: "Dedicated",
typeName: "CdnCertificateSourceParameters"
},
protocolType: "ServerNameIndication"
}
case SkuNames.standard_akamai:
return {
certificateSource: "Cdn",
certificateSourceParameters: {
certificateType: "Shared",
typeName: "CdnCertificateSourceParameters"
},
protocolType: "ServerNameIndication"
}
case SkuNames.standard_verizon:
return {
certificateSource: "Cdn",
certificateSourceParameters: {
certificateType: "Shared",
typeName: "CdnCertificateSourceParameters"
},
protocolType: "IPBased"
}
default:
return undefined;
}
}

// #endregion

// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);

Expand Down
4 changes: 2 additions & 2 deletions sdk/cdn/arm-cdn/src/operations/ruleSets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class RuleSetsImpl implements RuleSets {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor rule set under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down Expand Up @@ -350,7 +350,7 @@ export class RuleSetsImpl implements RuleSets {
}

/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor rule set under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down
5 changes: 3 additions & 2 deletions sdk/cdn/arm-cdn/src/operationsInterfaces/afdEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface AfdEndpoints {
options?: AfdEndpointsListByProfileOptionalParams
): PagedAsyncIterableIterator<AFDEndpoint>;
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor endpoint under the given CDN profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down Expand Up @@ -221,7 +221,8 @@ export interface AfdEndpoints {
options?: AfdEndpointsPurgeContentOptionalParams
): Promise<void>;
/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.This api
* isn't work for apex domain.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export interface AfdOriginGroups {
options?: AfdOriginGroupsListByProfileOptionalParams
): PagedAsyncIterableIterator<AFDOriginGroup>;
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
* Checks the quota and actual usage of the given AzureFrontDoor origin group under the given CDN
* profile.
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the Azure Front Door Standard or Azure Front Door Premium profile which
* is unique within the resource group.
Expand Down
Loading