/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; import * as Models from "../models"; import * as Mappers from "../models/imagesMappers"; import * as Parameters from "../models/parameters"; import { ComputeManagementClientContext } from "../computeManagementClientContext"; /** Class representing a Images. */ export class Images { private readonly client: ComputeManagementClientContext; /** * Create a Images. * @param {ComputeManagementClientContext} client Reference to the service client. */ constructor(client: ComputeManagementClientContext) { this.client = client; } /** * Create or update an image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param parameters Parameters supplied to the Create Image operation. * @param [options] The optional parameters * @returns Promise */ createOrUpdate(resourceGroupName: string, imageName: string, parameters: Models.Image, options?: msRest.RequestOptionsBase): Promise { return this.beginCreateOrUpdate(resourceGroupName,imageName,parameters,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** * Update an image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param parameters Parameters supplied to the Update Image operation. * @param [options] The optional parameters * @returns Promise */ update(resourceGroupName: string, imageName: string, parameters: Models.ImageUpdate, options?: msRest.RequestOptionsBase): Promise { return this.beginUpdate(resourceGroupName,imageName,parameters,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** * Deletes an Image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param [options] The optional parameters * @returns Promise */ deleteMethod(resourceGroupName: string, imageName: string, options?: msRest.RequestOptionsBase): Promise { return this.beginDeleteMethod(resourceGroupName,imageName,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** * Gets an image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param [options] The optional parameters * @returns Promise */ get(resourceGroupName: string, imageName: string, options?: Models.ImagesGetOptionalParams): Promise; /** * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param callback The callback */ get(resourceGroupName: string, imageName: string, callback: msRest.ServiceCallback): void; /** * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param options The optional parameters * @param callback The callback */ get(resourceGroupName: string, imageName: string, options: Models.ImagesGetOptionalParams, callback: msRest.ServiceCallback): void; get(resourceGroupName: string, imageName: string, options?: Models.ImagesGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceGroupName, imageName, options }, getOperationSpec, callback) as Promise; } /** * Gets the list of images under a resource group. * @param resourceGroupName The name of the resource group. * @param [options] The optional parameters * @returns Promise */ listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceGroupName The name of the resource group. * @param callback The callback */ listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; /** * @param resourceGroupName The name of the resource group. * @param options The optional parameters * @param callback The callback */ listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceGroupName, options }, listByResourceGroupOperationSpec, callback) as Promise; } /** * Gets the list of Images in the subscription. Use nextLink property in the response to get the * next page of Images. Do this till nextLink is null to fetch all the Images. * @param [options] The optional parameters * @returns Promise */ list(options?: msRest.RequestOptionsBase): Promise; /** * @param callback The callback */ list(callback: msRest.ServiceCallback): void; /** * @param options The optional parameters * @param callback The callback */ list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { options }, listOperationSpec, callback) as Promise; } /** * Create or update an image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param parameters Parameters supplied to the Create Image operation. * @param [options] The optional parameters * @returns Promise */ beginCreateOrUpdate(resourceGroupName: string, imageName: string, parameters: Models.Image, options?: msRest.RequestOptionsBase): Promise { return this.client.sendLRORequest( { resourceGroupName, imageName, parameters, options }, beginCreateOrUpdateOperationSpec, options); } /** * Update an image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param parameters Parameters supplied to the Update Image operation. * @param [options] The optional parameters * @returns Promise */ beginUpdate(resourceGroupName: string, imageName: string, parameters: Models.ImageUpdate, options?: msRest.RequestOptionsBase): Promise { return this.client.sendLRORequest( { resourceGroupName, imageName, parameters, options }, beginUpdateOperationSpec, options); } /** * Deletes an Image. * @param resourceGroupName The name of the resource group. * @param imageName The name of the image. * @param [options] The optional parameters * @returns Promise */ beginDeleteMethod(resourceGroupName: string, imageName: string, options?: msRest.RequestOptionsBase): Promise { return this.client.sendLRORequest( { resourceGroupName, imageName, options }, beginDeleteMethodOperationSpec, options); } /** * Gets the list of images under a resource group. * @param nextPageLink The NextLink from the previous successful call to List operation. * @param [options] The optional parameters * @returns Promise */ listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param callback The callback */ listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param options The optional parameters * @param callback The callback */ listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { nextPageLink, options }, listByResourceGroupNextOperationSpec, callback) as Promise; } /** * Gets the list of Images in the subscription. Use nextLink property in the response to get the * next page of Images. Do this till nextLink is null to fetch all the Images. * @param nextPageLink The NextLink from the previous successful call to List operation. * @param [options] The optional parameters * @returns Promise */ listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param callback The callback */ listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; /** * @param nextPageLink The NextLink from the previous successful call to List operation. * @param options The optional parameters * @param callback The callback */ listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { nextPageLink, options }, listNextOperationSpec, callback) as Promise; } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const getOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", urlParameters: [ Parameters.resourceGroupName, Parameters.imageName, Parameters.subscriptionId ], queryParameters: [ Parameters.expand0, Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.Image }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const listByResourceGroupOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", urlParameters: [ Parameters.resourceGroupName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.ImageListResult }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", urlParameters: [ Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.ImageListResult }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { httpMethod: "PUT", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", urlParameters: [ Parameters.resourceGroupName, Parameters.imageName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.Image, required: true } }, responses: { 200: { bodyMapper: Mappers.Image }, 201: { bodyMapper: Mappers.Image }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginUpdateOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", urlParameters: [ Parameters.resourceGroupName, Parameters.imageName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.ImageUpdate, required: true } }, responses: { 200: { bodyMapper: Mappers.Image }, 201: { bodyMapper: Mappers.Image }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginDeleteMethodOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", urlParameters: [ Parameters.resourceGroupName, Parameters.imageName, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.OperationStatusResponse }, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, serializer }; const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com", path: "{nextLink}", urlParameters: [ Parameters.nextPageLink ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.ImageListResult }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com", path: "{nextLink}", urlParameters: [ Parameters.nextPageLink ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.ImageListResult }, default: { bodyMapper: Mappers.CloudError } }, serializer };