UNPKG

@azure/arm-resources

Version:
1,130 lines 49 kB
/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; import { setContinuationToken } from "../pagingHelper.js"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers.js"; import * as Parameters from "../models/parameters.js"; import { createHttpPoller, } from "@azure/core-lro"; import { createLroSpec } from "../lroImpl.js"; /// <reference lib="esnext.asynciterable" /> /** Class containing Resources operations. */ export class ResourcesImpl { /** * Initialize a new instance of the class Resources class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Get all the resources for a resource group. * @param resourceGroupName The resource group with the resources to get. * @param options The options parameters. */ listByResourceGroup(resourceGroupName, options) { const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listByResourceGroupPagingPage(resourceGroupName, options, settings); }, }; } listByResourceGroupPagingPage(resourceGroupName, options, settings) { return __asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() { let result; let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken; if (!continuationToken) { result = yield __await(this._listByResourceGroup(resourceGroupName, options)); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield yield __await(page); } while (continuationToken) { result = yield __await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options)); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield yield __await(page); } }); } listByResourceGroupPagingAll(resourceGroupName, options) { return __asyncGenerator(this, arguments, function* listByResourceGroupPagingAll_1() { var _a, e_1, _b, _c; try { for (var _d = true, _e = __asyncValues(this.listByResourceGroupPagingPage(resourceGroupName, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) { _c = _f.value; _d = false; const page = _c; yield __await(yield* __asyncDelegator(__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e)); } finally { if (e_1) throw e_1.error; } } }); } /** * Get all the resources in a subscription. * @param options The options parameters. */ list(options) { const iter = this.listPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listPagingPage(options, settings); }, }; } listPagingPage(options, settings) { return __asyncGenerator(this, arguments, function* listPagingPage_1() { let result; let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken; if (!continuationToken) { result = yield __await(this._list(options)); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield yield __await(page); } while (continuationToken) { result = yield __await(this._listNext(continuationToken, options)); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield yield __await(page); } }); } listPagingAll(options) { return __asyncGenerator(this, arguments, function* listPagingAll_1() { var _a, e_2, _b, _c; try { for (var _d = true, _e = __asyncValues(this.listPagingPage(options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) { _c = _f.value; _d = false; const page = _c; yield __await(yield* __asyncDelegator(__asyncValues(page))); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e)); } finally { if (e_2) throw e_2.error; } } }); } /** * Get all the resources for a resource group. * @param resourceGroupName The resource group with the resources to get. * @param options The options parameters. */ _listByResourceGroup(resourceGroupName, options) { return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec); } /** * The resources to be moved must be in the same source resource group in the source subscription being * used. The target resource group may be in a different subscription. When moving resources, both the * source group and the target group are locked for the duration of the operation. Write and delete * operations are blocked on the groups until the move completes. * @param sourceResourceGroupName The name of the resource group from the source subscription * containing the resources to be moved. * @param parameters Parameters for moving resources. * @param options The options parameters. */ async beginMoveResources(sourceResourceGroupName, parameters, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { sourceResourceGroupName, parameters, options }, spec: moveResourcesOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * The resources to be moved must be in the same source resource group in the source subscription being * used. The target resource group may be in a different subscription. When moving resources, both the * source group and the target group are locked for the duration of the operation. Write and delete * operations are blocked on the groups until the move completes. * @param sourceResourceGroupName The name of the resource group from the source subscription * containing the resources to be moved. * @param parameters Parameters for moving resources. * @param options The options parameters. */ async beginMoveResourcesAndWait(sourceResourceGroupName, parameters, options) { const poller = await this.beginMoveResources(sourceResourceGroupName, parameters, options); return poller.pollUntilDone(); } /** * This operation checks whether the specified resources can be moved to the target. The resources to * be moved must be in the same source resource group in the source subscription being used. The target * resource group may be in a different subscription. If validation succeeds, it returns HTTP response * code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an * error message. Retrieve the URL in the Location header value to check the result of the long-running * operation. * @param sourceResourceGroupName The name of the resource group from the source subscription * containing the resources to be validated for move. * @param parameters Parameters for moving resources. * @param options The options parameters. */ async beginValidateMoveResources(sourceResourceGroupName, parameters, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { sourceResourceGroupName, parameters, options }, spec: validateMoveResourcesOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * This operation checks whether the specified resources can be moved to the target. The resources to * be moved must be in the same source resource group in the source subscription being used. The target * resource group may be in a different subscription. If validation succeeds, it returns HTTP response * code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an * error message. Retrieve the URL in the Location header value to check the result of the long-running * operation. * @param sourceResourceGroupName The name of the resource group from the source subscription * containing the resources to be validated for move. * @param parameters Parameters for moving resources. * @param options The options parameters. */ async beginValidateMoveResourcesAndWait(sourceResourceGroupName, parameters, options) { const poller = await this.beginValidateMoveResources(sourceResourceGroupName, parameters, options); return poller.pollUntilDone(); } /** * Get all the resources in a subscription. * @param options The options parameters. */ _list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Checks whether a resource exists. * @param resourceGroupName The name of the resource group containing the resource to check. The name * is case insensitive. * @param resourceProviderNamespace The resource provider of the resource to check. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type. * @param resourceName The name of the resource to check whether it exists. * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ checkExistence(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) { return this.client.sendOperationRequest({ resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options, }, checkExistenceOperationSpec); } /** * Deletes a resource. * @param resourceGroupName The name of the resource group that contains the resource to delete. The * name is case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type. * @param resourceName The name of the resource to delete. * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ async beginDelete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options, }, spec: deleteOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * Deletes a resource. * @param resourceGroupName The name of the resource group that contains the resource to delete. The * name is case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type. * @param resourceName The name of the resource to delete. * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ async beginDeleteAndWait(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) { const poller = await this.beginDelete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options); return poller.pollUntilDone(); } /** * Creates a resource. * @param resourceGroupName The name of the resource group for the resource. The name is case * insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource to create. * @param resourceName The name of the resource to create. * @param apiVersion The API version to use for the operation. * @param parameters Parameters for creating or updating the resource. * @param options The options parameters. */ async beginCreateOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options, }, spec: createOrUpdateOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * Creates a resource. * @param resourceGroupName The name of the resource group for the resource. The name is case * insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource to create. * @param resourceName The name of the resource to create. * @param apiVersion The API version to use for the operation. * @param parameters Parameters for creating or updating the resource. * @param options The options parameters. */ async beginCreateOrUpdateAndWait(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) { const poller = await this.beginCreateOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options); return poller.pollUntilDone(); } /** * Updates a resource. * @param resourceGroupName The name of the resource group for the resource. The name is case * insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource to update. * @param resourceName The name of the resource to update. * @param apiVersion The API version to use for the operation. * @param parameters Parameters for updating the resource. * @param options The options parameters. */ async beginUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options, }, spec: updateOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * Updates a resource. * @param resourceGroupName The name of the resource group for the resource. The name is case * insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource to update. * @param resourceName The name of the resource to update. * @param apiVersion The API version to use for the operation. * @param parameters Parameters for updating the resource. * @param options The options parameters. */ async beginUpdateAndWait(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options) { const poller = await this.beginUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, options); return poller.pollUntilDone(); } /** * Gets a resource. * @param resourceGroupName The name of the resource group containing the resource to get. The name is * case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource. * @param resourceName The name of the resource to get. * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ get(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options) { return this.client.sendOperationRequest({ resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, options, }, getOperationSpec); } /** * Checks by ID whether a resource exists. This API currently works only for a limited set of Resource * providers. In the event that a Resource provider does not implement this API, ARM will respond with * a 405. The alternative then is to use the GET API to check for the existence of the resource. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ checkExistenceById(resourceId, apiVersion, options) { return this.client.sendOperationRequest({ resourceId, apiVersion, options }, checkExistenceByIdOperationSpec); } /** * Deletes a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ async beginDeleteById(resourceId, apiVersion, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { resourceId, apiVersion, options }, spec: deleteByIdOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * Deletes a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ async beginDeleteByIdAndWait(resourceId, apiVersion, options) { const poller = await this.beginDeleteById(resourceId, apiVersion, options); return poller.pollUntilDone(); } /** * Create a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param parameters Create or update resource parameters. * @param options The options parameters. */ async beginCreateOrUpdateById(resourceId, apiVersion, parameters, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { resourceId, apiVersion, parameters, options }, spec: createOrUpdateByIdOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * Create a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param parameters Create or update resource parameters. * @param options The options parameters. */ async beginCreateOrUpdateByIdAndWait(resourceId, apiVersion, parameters, options) { const poller = await this.beginCreateOrUpdateById(resourceId, apiVersion, parameters, options); return poller.pollUntilDone(); } /** * Updates a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param parameters Update resource parameters. * @param options The options parameters. */ async beginUpdateById(resourceId, apiVersion, parameters, options) { const directSendOperation = async (args, spec) => { return this.client.sendOperationRequest(args, spec); }; const sendOperationFn = async (args, spec) => { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON(), }, }; }; const lro = createLroSpec({ sendOperationFn, args: { resourceId, apiVersion, parameters, options }, spec: updateByIdOperationSpec, }); const poller = await createHttpPoller(lro, { restoreFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, }); await poller.poll(); return poller; } /** * Updates a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param parameters Update resource parameters. * @param options The options parameters. */ async beginUpdateByIdAndWait(resourceId, apiVersion, parameters, options) { const poller = await this.beginUpdateById(resourceId, apiVersion, parameters, options); return poller.pollUntilDone(); } /** * Gets a resource by ID. * @param resourceId The fully qualified ID of the resource, including the resource name and resource * type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} * @param apiVersion The API version to use for the operation. * @param options The options parameters. */ getById(resourceId, apiVersion, options) { return this.client.sendOperationRequest({ resourceId, apiVersion, options }, getByIdOperationSpec); } /** * ListByResourceGroupNext * @param resourceGroupName The resource group with the resources to get. * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. * @param options The options parameters. */ _listByResourceGroupNext(resourceGroupName, nextLink, options) { return this.client.sendOperationRequest({ resourceGroupName, nextLink, options }, listByResourceGroupNextOperationSpec); } /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ _listNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listByResourceGroupOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ResourceListResult, }, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [ Parameters.apiVersion, Parameters.filter, Parameters.top, Parameters.expand, ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, ], headerParameters: [Parameters.accept], serializer, }; const moveResourcesOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError, }, }, requestBody: Parameters.parameters4, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.sourceResourceGroupName, ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer, }; const validateMoveResourcesOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError, }, }, requestBody: Parameters.parameters4, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.sourceResourceGroupName, ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer, }; const listOperationSpec = { path: "/subscriptions/{subscriptionId}/resources", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ResourceListResult, }, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [ Parameters.apiVersion, Parameters.filter, Parameters.top, Parameters.expand, ], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], serializer, }; const checkExistenceOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", httpMethod: "HEAD", responses: { 204: {}, 404: {}, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceProviderNamespace, Parameters.parentResourcePath, Parameters.resourceType, Parameters.resourceName, ], headerParameters: [Parameters.accept], serializer, }; const deleteOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", httpMethod: "DELETE", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceProviderNamespace, Parameters.parentResourcePath, Parameters.resourceType, Parameters.resourceName, ], headerParameters: [Parameters.accept], serializer, }; const createOrUpdateOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.GenericResource, }, 201: { bodyMapper: Mappers.GenericResource, }, 202: { bodyMapper: Mappers.GenericResource, }, 204: { bodyMapper: Mappers.GenericResource, }, default: { bodyMapper: Mappers.CloudError, }, }, requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceProviderNamespace, Parameters.parentResourcePath, Parameters.resourceType, Parameters.resourceName, ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer, }; const updateOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.GenericResource, }, 201: { bodyMapper: Mappers.GenericResource, }, 202: { bodyMapper: Mappers.GenericResource, }, 204: { bodyMapper: Mappers.GenericResource, }, default: { bodyMapper: Mappers.CloudError, }, }, requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceProviderNamespace, Parameters.parentResourcePath, Parameters.resourceType, Parameters.resourceName, ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer, }; const getOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.GenericResource, }, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceProviderNamespace, Parameters.parentResourcePath, Parameters.resourceType, Parameters.resourceName, ], headerParameters: [Parameters.accept], serializer, }; const checkExistenceByIdOperationSpec = { path: "/{resourceId}", httpMethod: "HEAD", responses: { 204: {}, 404: {}, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.resourceId], headerParameters: [Parameters.accept], serializer, }; const deleteByIdOperationSpec = { path: "/{resourceId}", httpMethod: "DELETE", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.resourceId], headerParameters: [Parameters.accept], serializer, }; const createOrUpdateByIdOperationSpec = { path: "/{resourceId}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.GenericResource, }, 201: { bodyMapper: Mappers.GenericResource, }, 202: { bodyMapper: Mappers.GenericResource, }, 204: { bodyMapper: Mappers.GenericResource, }, default: { bodyMapper: Mappers.CloudError, }, }, requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.resourceId], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer, }; const updateByIdOperationSpec = { path: "/{resourceId}", httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.GenericResource, }, 201: { bodyMapper: Mappers.GenericResource, }, 202: { bodyMapper: Mappers.GenericResource, }, 204: { bodyMapper: Mappers.GenericResource, }, default: { bodyMapper: Mappers.CloudError, }, }, requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.resourceId], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer, }; const getByIdOperationSpec = { path: "/{resourceId}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.GenericResource, }, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion1], urlParameters: [Parameters.$host, Parameters.resourceId], headerParameters: [Parameters.accept], serializer, }; const listByResourceGroupNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ResourceListResult, }, default: { bodyMapper: Mappers.CloudError, }, }, urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, Parameters.resourceGroupName, ], headerParameters: [Parameters.accept], serializer, }; const listNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ResourceListResult, }, default: { bodyMapper: Mappers.CloudError, }, }, urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, ], headerParameters: [Parameters.accept], serializer, }; //# sourceMappingURL=resources.js.map