diff --git a/sdk/resources/arm-resources/src/models/index.ts b/sdk/resources/arm-resources/src/models/index.ts index f5faeb25a2e2..48a27dd7e52d 100644 --- a/sdk/resources/arm-resources/src/models/index.ts +++ b/sdk/resources/arm-resources/src/models/index.ts @@ -3092,6 +3092,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/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 1dc03c3fa11f..666af90b31ae 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"; diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index a4f763911359..0387101043cb 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -5,7 +5,8 @@ "typescript": "", "license-header": "MICROSOFT_MIT_NO_VERSION", "sdkrel:typescript-sdks-folder": ".", - "use": "@microsoft.azure/autorest.typescript@4.1.1" + "typescript.clear-output-folder": "", + "use": "@microsoft.azure/autorest.typescript@4.2.2" }, "advanced_options": { "clone_dir": "./azure-sdk-for-js",