Skip to content
Merged
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
2 changes: 1 addition & 1 deletion sdk/cdn/arm-cdn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@azure/arm-cdn",
"author": "Microsoft Corporation",
"description": "CdnManagementClient Library with typescript type definitions for node.js and browser.",
"version": "5.0.0",
"version": "5.1.0",
"dependencies": {
"@azure/ms-rest-azure-js": "^2.0.1",
"@azure/ms-rest-js": "^2.0.4",
Expand Down
2 changes: 1 addition & 1 deletion sdk/cdn/arm-cdn/src/cdnManagementClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";

const packageName = "@azure/arm-cdn";
const packageVersion = "5.0.0";
const packageVersion = "5.1.0";

export class CdnManagementClientContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials;
Expand Down
91 changes: 79 additions & 12 deletions sdk/cdn/arm-cdn/src/operations/customDomains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as Models from "../models";
import * as Mappers from "../models/customDomainsMappers";
import * as Parameters from "../models/parameters";
import { CdnManagementClientContext } from "../cdnManagementClientContext";
import { Profiles } from "./profiles";

/** Class representing a CustomDomains. */
export class CustomDomains {
Expand Down Expand Up @@ -114,7 +115,7 @@ export class CustomDomains {
* @returns Promise<Models.CustomDomainsCreateResponse>
*/
create(resourceGroupName: string, profileName: string, endpointName: string, customDomainName: string, hostName: string, options?: msRest.RequestOptionsBase): Promise<Models.CustomDomainsCreateResponse> {
return this.beginCreate(resourceGroupName,profileName,endpointName,customDomainName,hostName,options)
return this.beginCreate(resourceGroupName, profileName, endpointName, customDomainName, hostName, options)
.then(lroPoller => lroPoller.pollUntilFinished()) as Promise<Models.CustomDomainsCreateResponse>;
}

Expand All @@ -128,7 +129,7 @@ export class CustomDomains {
* @returns Promise<Models.CustomDomainsDeleteMethodResponse>
*/
deleteMethod(resourceGroupName: string, profileName: string, endpointName: string, customDomainName: string, options?: msRest.RequestOptionsBase): Promise<Models.CustomDomainsDeleteMethodResponse> {
return this.beginDeleteMethod(resourceGroupName,profileName,endpointName,customDomainName,options)
return this.beginDeleteMethod(resourceGroupName, profileName, endpointName, customDomainName, options)
.then(lroPoller => lroPoller.pollUntilFinished()) as Promise<Models.CustomDomainsDeleteMethodResponse>;
}

Expand Down Expand Up @@ -200,16 +201,42 @@ export class CustomDomains {
*/
enableCustomHttps(resourceGroupName: string, profileName: string, endpointName: string, customDomainName: string, options: Models.CustomDomainsEnableCustomHttpsOptionalParams, callback: msRest.ServiceCallback<Models.CustomDomain>): void;
enableCustomHttps(resourceGroupName: string, profileName: string, endpointName: string, customDomainName: string, options?: Models.CustomDomainsEnableCustomHttpsOptionalParams | msRest.ServiceCallback<Models.CustomDomain>, callback?: msRest.ServiceCallback<Models.CustomDomain>): Promise<Models.CustomDomainsEnableCustomHttpsResponse> {
return this.client.sendOperationRequest(
{
resourceGroupName,
profileName,
endpointName,
customDomainName,
options
},
enableCustomHttpsOperationSpec,
callback) as Promise<Models.CustomDomainsEnableCustomHttpsResponse>;
// #region Added default values to add backwards compatibility
let newOptions: Models.CustomDomainsEnableCustomHttpsOptionalParams = {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next time we auto generate this package, the hand written code here will get over written. Please use the #region notation to mark this block of code as hand written. This way when we review the next auto generated code and see this block deleted, we can add it back knowing that this was added intentionally.


if (typeof options === "function") {
callback = options;
} else {
newOptions = options as Models.CustomDomainsEnableCustomHttpsOptionalParams;
}

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

let optionsPreparationPromise = Promise.resolve(options);

if (!newOptions.customDomainHttpsParameters) {
let profiles = new Profiles(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,
callback) as Promise<Models.CustomDomainsEnableCustomHttpsResponse>
);
// #endregion
}

/**
Expand Down Expand Up @@ -287,6 +314,46 @@ export class 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"
},
protocolType: "ServerNameIndication"
}
case SkuNames.standard_akamai:
return {
certificateSource: "Cdn",
certificateSourceParameters: {
certificateType: "Shared"
},
protocolType: "ServerNameIndication"
}
case SkuNames.standard_verizon:
return {
certificateSource: "Cdn",
certificateSourceParameters: {
certificateType: "Shared"
},
protocolType: "IPBased"
}
default:
return undefined;
}
}

// #endregion

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const listByEndpointOperationSpec: msRest.OperationSpec = {
Expand Down