From 19a65d4de55cfade35e4c9e352592085be2abab0 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 3 Sep 2019 08:47:14 +0000 Subject: [PATCH] Generated from 6dccd190b0cc4c4cceecec3c87b49e4e6e6126a0 Merge pull request #3 from Azure/master invalid non ascii character was causing problems (#7102) --- .../src/models/deploymentsMappers.ts | 1 + .../arm-resources/src/models/index.ts | 479 +++++++++++++++++- .../arm-resources/src/models/mappers.ts | 29 +- .../src/operations/deployments.ts | 84 ++- .../src/operations/resourceGroups.ts | 99 ++-- .../src/resourceManagementClientContext.ts | 2 +- 6 files changed, 613 insertions(+), 81 deletions(-) diff --git a/sdk/resources/arm-resources/src/models/deploymentsMappers.ts b/sdk/resources/arm-resources/src/models/deploymentsMappers.ts index 64feaeccb3ce..c489812eadc8 100644 --- a/sdk/resources/arm-resources/src/models/deploymentsMappers.ts +++ b/sdk/resources/arm-resources/src/models/deploymentsMappers.ts @@ -39,5 +39,6 @@ export { SubResource, TagCount, TagValue, + TemplateHashResult, TemplateLink } from "../models/mappers"; diff --git a/sdk/resources/arm-resources/src/models/index.ts b/sdk/resources/arm-resources/src/models/index.ts index 3c6fde6acbe4..13828a40a10d 100644 --- a/sdk/resources/arm-resources/src/models/index.ts +++ b/sdk/resources/arm-resources/src/models/index.ts @@ -447,10 +447,6 @@ export interface DeploymentPropertiesExtended { * Information from validate template deployment response. */ export interface DeploymentValidateResult { - /** - * The deployment validation error. - */ - error?: ErrorResponse; /** * The template deployment properties. */ @@ -988,6 +984,51 @@ export interface Operation { display?: OperationDisplay; } +/** + * Result of the request to calculate template hash. It contains a string of minified template and + * its hash. + */ +export interface TemplateHashResult { + /** + * The minified template string. + */ + minifiedTemplate?: string; + /** + * The template hash. + */ + templateHash?: string; +} + +/** + * Optional Parameters. + */ +export interface DeploymentsListAtScopeOptionalParams extends msRest.RequestOptionsBase { + /** + * The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + */ + filter?: string; + /** + * The number of results to get. If null is passed, returns all deployments. + */ + top?: number; +} + +/** + * Optional Parameters. + */ +export interface DeploymentsListAtTenantScopeOptionalParams extends msRest.RequestOptionsBase { + /** + * The filter to apply on the operation. For example, you can use $filter=provisioningState eq + * '{state}'. + */ + filter?: string; + /** + * The number of results to get. If null is passed, returns all deployments. + */ + top?: number; +} + /** * Optional Parameters. */ @@ -2033,6 +2074,26 @@ export type DeploymentsListByResourceGroupResponse = DeploymentListResult & { }; }; +/** + * Contains response data for the calculateTemplateHash operation. + */ +export type DeploymentsCalculateTemplateHashResponse = TemplateHashResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: TemplateHashResult; + }; +}; + /** * Contains response data for the beginCreateOrUpdateAtScope operation. */ @@ -2543,6 +2604,396 @@ export type ResourcesCheckExistenceByIdResponse = { }; }; +/** + * Contains response data for the createOrUpdateById operation. + */ +export type DeploymentsListAtTenantScopeNextResponse = DeploymentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DeploymentListResult; + }; +}; + +/** + * Contains response data for the listAtManagementGroupScopeNext operation. + */ +export type DeploymentsListAtManagementGroupScopeNextResponse = DeploymentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DeploymentListResult; + }; +}; + +/** + * Contains response data for the listAtSubscriptionScopeNext operation. + */ +export type DeploymentsListAtSubscriptionScopeNextResponse = DeploymentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DeploymentListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroupNext operation. + */ +export type DeploymentsListByResourceGroupNextResponse = DeploymentListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DeploymentListResult; + }; +}; + +/** + * Contains response data for the unregister operation. + */ +export type ProvidersUnregisterResponse = Provider & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Provider; + }; +}; + +/** + * Contains response data for the register operation. + */ +export type ProvidersRegisterResponse = Provider & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Provider; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ProvidersListResponse = ProviderListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderListResult; + }; +}; + +/** + * Contains response data for the listAtTenantScope operation. + */ +export type ProvidersListAtTenantScopeResponse = ProviderListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ProvidersGetResponse = Provider & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Provider; + }; +}; + +/** + * Contains response data for the getAtTenantScope operation. + */ +export type ProvidersGetAtTenantScopeResponse = Provider & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: Provider; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ProvidersListNextResponse = ProviderListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderListResult; + }; +}; + +/** + * Contains response data for the listAtTenantScopeNext operation. + */ +export type ProvidersListAtTenantScopeNextResponse = ProviderListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ProviderListResult; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type ResourcesListByResourceGroupResponse = ResourceListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ResourceListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ResourcesListResponse = ResourceListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ResourceListResult; + }; +}; + +/** + * Contains response data for the checkExistence operation. + */ +export type ResourcesCheckExistenceResponse = { + /** + * The parsed response body. + */ + body: boolean; + + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: boolean; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type ResourcesCreateOrUpdateResponse = GenericResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GenericResource; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type ResourcesUpdateResponse = GenericResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GenericResource; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type ResourcesGetResponse = GenericResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GenericResource; + }; +}; + +/** + * Contains response data for the checkExistenceById operation. + */ +export type ResourcesCheckExistenceByIdResponse = { + /** + * The parsed response body. + */ + body: boolean; + + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: boolean; + }; +}; + /** * Contains response data for the createOrUpdateById operation. */ @@ -2848,6 +3299,26 @@ export type ResourceGroupsListResponse = ResourceGroupListResult & { }; }; +/** + * Contains response data for the beginExportTemplate operation. + */ +export type ResourceGroupsBeginExportTemplateResponse = ResourceGroupExportResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ResourceGroupExportResult; + }; +}; + /** * Contains response data for the listNext operation. */ diff --git a/sdk/resources/arm-resources/src/models/mappers.ts b/sdk/resources/arm-resources/src/models/mappers.ts index 7cec39e712bf..6ece0cbd4399 100644 --- a/sdk/resources/arm-resources/src/models/mappers.ts +++ b/sdk/resources/arm-resources/src/models/mappers.ts @@ -745,13 +745,6 @@ export const DeploymentValidateResult: msRest.CompositeMapper = { name: "Composite", className: "DeploymentValidateResult", modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorResponse" - } - }, properties: { serializedName: "properties", type: { @@ -1620,6 +1613,28 @@ export const Operation: msRest.CompositeMapper = { } }; +export const TemplateHashResult: msRest.CompositeMapper = { + serializedName: "TemplateHashResult", + type: { + name: "Composite", + className: "TemplateHashResult", + modelProperties: { + minifiedTemplate: { + serializedName: "minifiedTemplate", + type: { + name: "String" + } + }, + templateHash: { + serializedName: "templateHash", + type: { + name: "String" + } + } + } + } +}; + export const OperationListResult: msRest.CompositeMapper = { serializedName: "OperationListResult", type: { diff --git a/sdk/resources/arm-resources/src/operations/deployments.ts b/sdk/resources/arm-resources/src/operations/deployments.ts index b534a54e03ab..b465ce839dc2 100644 --- a/sdk/resources/arm-resources/src/operations/deployments.ts +++ b/sdk/resources/arm-resources/src/operations/deployments.ts @@ -738,10 +738,12 @@ export class Deployments { } /** - * You can provide the template and parameters directly in the request or link to JSON files. - * @summary Deploys resources at subscription scope. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the + * deployment is canceled, the provisioningState is set to Canceled. Canceling a template + * deployment stops the currently running template deployment and leaves the resources partially + * deployed. + * @summary Cancels a currently running template deployment. * @param deploymentName The name of the deployment. - * @param parameters Additional parameters supplied to the operation. * @param [options] The optional parameters * @returns Promise */ @@ -785,6 +787,7 @@ export class Deployments { * deployed. * @summary Cancels a currently running template deployment. * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. * @param [options] The optional parameters * @returns Promise */ @@ -804,6 +807,7 @@ export class Deployments { return this.client.sendOperationRequest( { deploymentName, + parameters, options }, cancelAtSubscriptionScopeOperationSpec, @@ -836,7 +840,6 @@ export class Deployments { return this.client.sendOperationRequest( { deploymentName, - parameters, options }, validateAtSubscriptionScopeOperationSpec, @@ -1137,6 +1140,34 @@ export class Deployments { callback) as Promise; } + /** + * Calculate the hash of the given template. + * @param template The template provided to calculate hash. + * @param [options] The optional parameters + * @returns Promise + */ + calculateTemplateHash(template: any, options?: msRest.RequestOptionsBase): Promise; + /** + * @param template The template provided to calculate hash. + * @param callback The callback + */ + calculateTemplateHash(template: any, callback: msRest.ServiceCallback): void; + /** + * @param template The template provided to calculate hash. + * @param options The optional parameters + * @param callback The callback + */ + calculateTemplateHash(template: any, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + calculateTemplateHash(template: any, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + template, + options + }, + calculateTemplateHashOperationSpec, + callback) as Promise; + } + /** * A template deployment that is currently running cannot be deleted. Deleting a template * deployment removes the associated deployment operations. This is an asynchronous operation that @@ -1598,9 +1629,6 @@ const validateAtScopeOperationSpec: msRest.OperationSpec = { 200: { bodyMapper: Mappers.DeploymentValidateResult }, - 400: { - bodyMapper: Mappers.DeploymentValidateResult - }, default: { bodyMapper: Mappers.CloudError } @@ -1746,9 +1774,6 @@ const validateAtTenantScopeOperationSpec: msRest.OperationSpec = { 200: { bodyMapper: Mappers.DeploymentValidateResult }, - 400: { - bodyMapper: Mappers.DeploymentValidateResult - }, default: { bodyMapper: Mappers.CloudError } @@ -1894,9 +1919,6 @@ const validateAtManagementGroupScopeOperationSpec: msRest.OperationSpec = { 200: { bodyMapper: Mappers.DeploymentValidateResult }, - 400: { - bodyMapper: Mappers.DeploymentValidateResult - }, default: { bodyMapper: Mappers.CloudError } @@ -2046,9 +2068,6 @@ const validateAtSubscriptionScopeOperationSpec: msRest.OperationSpec = { 200: { bodyMapper: Mappers.DeploymentValidateResult }, - 400: { - bodyMapper: Mappers.DeploymentValidateResult - }, default: { bodyMapper: Mappers.CloudError } @@ -2202,9 +2221,6 @@ const validateOperationSpec: msRest.OperationSpec = { 200: { bodyMapper: Mappers.DeploymentValidateResult }, - 400: { - bodyMapper: Mappers.DeploymentValidateResult - }, default: { bodyMapper: Mappers.CloudError } @@ -2263,6 +2279,36 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { serializer }; +const calculateTemplateHashOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Resources/calculateTemplateHash", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "template", + mapper: { + required: true, + serializedName: "template", + type: { + name: "Object" + } + } + }, + responses: { + 200: { + bodyMapper: Mappers.TemplateHashResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + const beginDeleteAtScopeOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "{scope}/providers/Microsoft.Resources/deployments/{deploymentName}", diff --git a/sdk/resources/arm-resources/src/operations/resourceGroups.ts b/sdk/resources/arm-resources/src/operations/resourceGroups.ts index 6411c09ca1ed..617190a57bc6 100644 --- a/sdk/resources/arm-resources/src/operations/resourceGroups.ts +++ b/sdk/resources/arm-resources/src/operations/resourceGroups.ts @@ -171,34 +171,14 @@ export class ResourceGroups { /** * Captures the specified resource group as a template. - * @param resourceGroupName The name of the resource group to export as a template. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param parameters Parameters for exporting the template. * @param [options] The optional parameters * @returns Promise */ - exportTemplate(resourceGroupName: string, parameters: Models.ExportTemplateRequest, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group to export as a template. - * @param parameters Parameters for exporting the template. - * @param callback The callback - */ - exportTemplate(resourceGroupName: string, parameters: Models.ExportTemplateRequest, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group to export as a template. - * @param parameters Parameters for exporting the template. - * @param options The optional parameters - * @param callback The callback - */ - exportTemplate(resourceGroupName: string, parameters: Models.ExportTemplateRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - exportTemplate(resourceGroupName: string, parameters: Models.ExportTemplateRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - parameters, - options - }, - exportTemplateOperationSpec, - callback) as Promise; + exportTemplate(resourceGroupName: string, parameters: Models.ExportTemplateRequest, options?: msRest.RequestOptionsBase): Promise { + return this.beginExportTemplate(resourceGroupName,parameters,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** @@ -243,6 +223,24 @@ export class ResourceGroups { options); } + /** + * Captures the specified resource group as a template. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters Parameters for exporting the template. + * @param [options] The optional parameters + * @returns Promise + */ + beginExportTemplate(resourceGroupName: string, parameters: Models.ExportTemplateRequest, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + resourceGroupName, + parameters, + options + }, + beginExportTemplateOperationSpec, + options); + } + /** * Gets all the resource groups for a subscription. * @param nextPageLink The NextLink from the previous successful call to List operation. @@ -386,29 +384,23 @@ const updateOperationSpec: msRest.OperationSpec = { serializer }; -const exportTemplateOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate", +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourcegroups", urlParameters: [ - Parameters.resourceGroupName, Parameters.subscriptionId ], queryParameters: [ + Parameters.filter, + Parameters.top, Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ExportTemplateRequest, - required: true - } - }, responses: { 200: { - bodyMapper: Mappers.ResourceGroupExportResult + bodyMapper: Mappers.ResourceGroupListResult }, default: { bodyMapper: Mappers.CloudError @@ -417,24 +409,22 @@ const exportTemplateOperationSpec: msRest.OperationSpec = { serializer }; -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups", +const beginDeleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", urlParameters: [ + Parameters.resourceGroupName, Parameters.subscriptionId ], queryParameters: [ - Parameters.filter, - Parameters.top, Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { - 200: { - bodyMapper: Mappers.ResourceGroupListResult - }, + 200: {}, + 202: {}, default: { bodyMapper: Mappers.CloudError } @@ -442,12 +432,12 @@ const listOperationSpec: msRest.OperationSpec = { serializer }; -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", +const beginExportTemplateOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate", urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId + Parameters.subscriptionId, + Parameters.resourceGroupName ], queryParameters: [ Parameters.apiVersion @@ -455,8 +445,17 @@ const beginDeleteMethodOperationSpec: msRest.OperationSpec = { headerParameters: [ Parameters.acceptLanguage ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.ExportTemplateRequest, + required: true + } + }, responses: { - 200: {}, + 200: { + bodyMapper: Mappers.ResourceGroupExportResult + }, 202: {}, default: { bodyMapper: Mappers.CloudError diff --git a/sdk/resources/arm-resources/src/resourceManagementClientContext.ts b/sdk/resources/arm-resources/src/resourceManagementClientContext.ts index d2e14d2a009f..7cfc8b2ef09d 100644 --- a/sdk/resources/arm-resources/src/resourceManagementClientContext.ts +++ b/sdk/resources/arm-resources/src/resourceManagementClientContext.ts @@ -44,7 +44,7 @@ export class ResourceManagementClientContext extends msRestAzure.AzureServiceCli super(credentials, options); - this.apiVersion = '2019-07-01'; + this.apiVersion = '2019-08-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";