@@ -14,6 +14,7 @@ import * as Models from "../models";
1414import * as Mappers from "../models/customDomainsMappers" ;
1515import * as Parameters from "../models/parameters" ;
1616import { CdnManagementClientContext } from "../cdnManagementClientContext" ;
17+ import { Profiles } from "./profiles" ;
1718
1819/** Class representing a CustomDomains. */
1920export class CustomDomains {
@@ -114,7 +115,7 @@ export class CustomDomains {
114115 * @returns Promise<Models.CustomDomainsCreateResponse>
115116 */
116117 create ( resourceGroupName : string , profileName : string , endpointName : string , customDomainName : string , hostName : string , options ?: msRest . RequestOptionsBase ) : Promise < Models . CustomDomainsCreateResponse > {
117- return this . beginCreate ( resourceGroupName , profileName , endpointName , customDomainName , hostName , options )
118+ return this . beginCreate ( resourceGroupName , profileName , endpointName , customDomainName , hostName , options )
118119 . then ( lroPoller => lroPoller . pollUntilFinished ( ) ) as Promise < Models . CustomDomainsCreateResponse > ;
119120 }
120121
@@ -128,7 +129,7 @@ export class CustomDomains {
128129 * @returns Promise<Models.CustomDomainsDeleteMethodResponse>
129130 */
130131 deleteMethod ( resourceGroupName : string , profileName : string , endpointName : string , customDomainName : string , options ?: msRest . RequestOptionsBase ) : Promise < Models . CustomDomainsDeleteMethodResponse > {
131- return this . beginDeleteMethod ( resourceGroupName , profileName , endpointName , customDomainName , options )
132+ return this . beginDeleteMethod ( resourceGroupName , profileName , endpointName , customDomainName , options )
132133 . then ( lroPoller => lroPoller . pollUntilFinished ( ) ) as Promise < Models . CustomDomainsDeleteMethodResponse > ;
133134 }
134135
@@ -200,16 +201,42 @@ export class CustomDomains {
200201 */
201202 enableCustomHttps ( resourceGroupName : string , profileName : string , endpointName : string , customDomainName : string , options : Models . CustomDomainsEnableCustomHttpsOptionalParams , callback : msRest . ServiceCallback < Models . CustomDomain > ) : void ;
202203 enableCustomHttps ( resourceGroupName : string , profileName : string , endpointName : string , customDomainName : string , options ?: Models . CustomDomainsEnableCustomHttpsOptionalParams | msRest . ServiceCallback < Models . CustomDomain > , callback ?: msRest . ServiceCallback < Models . CustomDomain > ) : Promise < Models . CustomDomainsEnableCustomHttpsResponse > {
203- return this . client . sendOperationRequest (
204- {
205- resourceGroupName,
206- profileName,
207- endpointName,
208- customDomainName,
209- options
210- } ,
211- enableCustomHttpsOperationSpec ,
212- callback ) as Promise < Models . CustomDomainsEnableCustomHttpsResponse > ;
204+ // #region Added default values to add backwards compatibility
205+ let newOptions : Models . CustomDomainsEnableCustomHttpsOptionalParams = { } ;
206+
207+ if ( typeof options === "function" ) {
208+ callback = options ;
209+ } else {
210+ newOptions = options as Models . CustomDomainsEnableCustomHttpsOptionalParams ;
211+ }
212+
213+ if ( ! newOptions ) {
214+ newOptions = { } ;
215+ }
216+
217+ let optionsPreparationPromise = Promise . resolve ( options ) ;
218+
219+ if ( ! newOptions . customDomainHttpsParameters ) {
220+ let profiles = new Profiles ( this . client ) ;
221+ optionsPreparationPromise = profiles . get ( resourceGroupName , profileName ) . then ( profile => {
222+ newOptions . customDomainHttpsParameters = getDefaultCustomDomainHttpsParameters ( profile ) ;
223+ return newOptions ;
224+ } )
225+ }
226+
227+ return optionsPreparationPromise . then ( options =>
228+ this . client . sendOperationRequest (
229+ {
230+ resourceGroupName,
231+ profileName,
232+ endpointName,
233+ customDomainName,
234+ options
235+ } ,
236+ enableCustomHttpsOperationSpec ,
237+ callback ) as Promise < Models . CustomDomainsEnableCustomHttpsResponse >
238+ ) ;
239+ // #endregion
213240 }
214241
215242 /**
@@ -287,6 +314,46 @@ export class CustomDomains {
287314 }
288315}
289316
317+ // #region Added default values to add backwards compatibility
318+ class SkuNames {
319+ public static get standard_microsoft ( ) { return "Standard_Microsoft" ; }
320+ public static get standard_verizon ( ) { return "Standard_Verizon" ; }
321+ public static get standard_akamai ( ) { return "Standard_Akamai" ; }
322+ }
323+
324+ function getDefaultCustomDomainHttpsParameters ( profile : Models . Profile ) : Models . CdnManagedHttpsParameters | undefined {
325+ switch ( profile . sku . name ) {
326+ case SkuNames . standard_microsoft :
327+ return {
328+ certificateSource : "Cdn" ,
329+ certificateSourceParameters : {
330+ certificateType : "Dedicated"
331+ } ,
332+ protocolType : "ServerNameIndication"
333+ }
334+ case SkuNames . standard_akamai :
335+ return {
336+ certificateSource : "Cdn" ,
337+ certificateSourceParameters : {
338+ certificateType : "Shared"
339+ } ,
340+ protocolType : "ServerNameIndication"
341+ }
342+ case SkuNames . standard_verizon :
343+ return {
344+ certificateSource : "Cdn" ,
345+ certificateSourceParameters : {
346+ certificateType : "Shared"
347+ } ,
348+ protocolType : "IPBased"
349+ }
350+ default :
351+ return undefined ;
352+ }
353+ }
354+
355+ // #endregion
356+
290357// Operation Specifications
291358const serializer = new msRest . Serializer ( Mappers ) ;
292359const listByEndpointOperationSpec : msRest . OperationSpec = {
0 commit comments