diff --git a/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts b/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts new file mode 100644 index 000000000000..182959d25ec0 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts @@ -0,0 +1,14 @@ +/* + * 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. + */ + +export { + discriminators, + AscOperation, + CloudError, + ErrorResponse +} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/index.ts b/sdk/storagecache/arm-storagecache/src/models/index.ts index 8c58bd4783db..54ef28aead03 100644 --- a/sdk/storagecache/arm-storagecache/src/models/index.ts +++ b/sdk/storagecache/arm-storagecache/src/models/index.ts @@ -67,6 +67,50 @@ export interface CloudErrorBody { target?: string; } +/** + * Describes the format of Error response. + */ +export interface ErrorResponse { + /** + * Error code + */ + code?: string; + /** + * Error message indicating why the operation failed. + */ + message?: string; +} + +/** + * The status of operation. + */ +export interface AscOperation { + /** + * The operation Id. + */ + id?: string; + /** + * The operation name. + */ + name?: string; + /** + * The start time of the operation. + */ + startTime?: string; + /** + * The end time of the operation. + */ + endTime?: string; + /** + * The status of the operation. + */ + status?: string; + /** + * The error detail of the operation if any. + */ + error?: ErrorResponse; +} + /** * Cache identity properties. */ @@ -953,6 +997,26 @@ export type UsageModelsListNextResponse = UsageModelsResult & { }; }; +/** + * Contains response data for the get operation. + */ +export type AscOperationsGetResponse = AscOperation & { + /** + * 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: AscOperation; + }; +}; + /** * Contains response data for the list operation. */ diff --git a/sdk/storagecache/arm-storagecache/src/models/mappers.ts b/sdk/storagecache/arm-storagecache/src/models/mappers.ts index 672eb04f432f..4ad1d29f2fd1 100644 --- a/sdk/storagecache/arm-storagecache/src/models/mappers.ts +++ b/sdk/storagecache/arm-storagecache/src/models/mappers.ts @@ -103,6 +103,75 @@ export const CloudErrorBody: msRest.CompositeMapper = { } }; +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const AscOperation: msRest.CompositeMapper = { + serializedName: "AscOperation", + type: { + name: "Composite", + className: "AscOperation", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponse" + } + } + } + } +}; + export const CacheIdentity: msRest.CompositeMapper = { serializedName: "CacheIdentity", type: { diff --git a/sdk/storagecache/arm-storagecache/src/models/parameters.ts b/sdk/storagecache/arm-storagecache/src/models/parameters.ts index dd3394f6db81..a3b5da619669 100644 --- a/sdk/storagecache/arm-storagecache/src/models/parameters.ts +++ b/sdk/storagecache/arm-storagecache/src/models/parameters.ts @@ -43,6 +43,16 @@ export const cacheName: msRest.OperationURLParameter = { } } }; +export const location: msRest.OperationURLParameter = { + parameterPath: "location", + mapper: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } +}; export const nextPageLink: msRest.OperationURLParameter = { parameterPath: "nextPageLink", mapper: { @@ -54,6 +64,16 @@ export const nextPageLink: msRest.OperationURLParameter = { }, skipEncoding: true }; +export const operationId: msRest.OperationURLParameter = { + parameterPath: "operationId", + mapper: { + required: true, + serializedName: "operationId", + type: { + name: "String" + } + } +}; export const resourceGroupName: msRest.OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { diff --git a/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts b/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts new file mode 100644 index 000000000000..3256448317ff --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts @@ -0,0 +1,87 @@ +/* + * 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 Models from "../models"; +import * as Mappers from "../models/ascOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; + +/** Class representing a AscOperations. */ +export class AscOperations { + private readonly client: StorageCacheManagementClientContext; + + /** + * Create a AscOperations. + * @param {StorageCacheManagementClientContext} client Reference to the service client. + */ + constructor(client: StorageCacheManagementClientContext) { + this.client = client; + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC cache + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @param [options] The optional parameters + * @returns Promise + */ + get(location: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @param callback The callback + */ + get(location: string, operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @param options The optional parameters + * @param callback The callback + */ + get(location: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(location: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + location, + operationId, + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.location, + Parameters.operationId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.AscOperation + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/storagecache/arm-storagecache/src/operations/index.ts b/sdk/storagecache/arm-storagecache/src/operations/index.ts index 461ea1b1d1b5..93f5a02cc48c 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/index.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/index.ts @@ -11,5 +11,6 @@ export * from "./operations"; export * from "./skus"; export * from "./usageModels"; +export * from "./ascOperations"; export * from "./caches"; export * from "./storageTargets"; diff --git a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts index 6380df6d5691..5c8331c8f305 100644 --- a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts +++ b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts @@ -20,6 +20,7 @@ class StorageCacheManagementClient extends StorageCacheManagementClientContext { operations: operations.Operations; skus: operations.Skus; usageModels: operations.UsageModels; + ascOperations: operations.AscOperations; caches: operations.Caches; storageTargets: operations.StorageTargets; @@ -35,6 +36,7 @@ class StorageCacheManagementClient extends StorageCacheManagementClientContext { this.operations = new operations.Operations(this); this.skus = new operations.Skus(this); this.usageModels = new operations.UsageModels(this); + this.ascOperations = new operations.AscOperations(this); this.caches = new operations.Caches(this); this.storageTargets = new operations.StorageTargets(this); }