diff --git a/sdk/cognitiveservices/arm-cognitiveservices/LICENSE.txt b/sdk/cognitiveservices/arm-cognitiveservices/LICENSE.txt index a70e8cf66038..b73b4a1293c3 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/LICENSE.txt +++ b/sdk/cognitiveservices/arm-cognitiveservices/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft +Copyright (c) 2019 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/cognitiveservices/arm-cognitiveservices/README.md b/sdk/cognitiveservices/arm-cognitiveservices/README.md index e98c1233d061..4258757bbea7 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/README.md +++ b/sdk/cognitiveservices/arm-cognitiveservices/README.md @@ -98,6 +98,3 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to ## Related projects - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/cognitiveservices/arm-cognitiveservices/README.png) diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/cognitiveServicesManagementClient.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/cognitiveServicesManagementClient.ts new file mode 100644 index 000000000000..e2d721fdca7c --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/cognitiveServicesManagementClient.ts @@ -0,0 +1,48 @@ +/* + * 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/mappers"; +import * as operations from "./operations"; +import { CognitiveServicesManagementClientContext } from "./cognitiveServicesManagementClientContext"; + + +class CognitiveServicesManagementClient extends CognitiveServicesManagementClientContext { + // Operation groups + accounts: operations.Accounts; + resourceSkus: operations.ResourceSkus; + operations: operations.Operations; + checkSkuAvailability: operations.CheckSkuAvailability; + + /** + * Initializes a new instance of the CognitiveServicesManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId Azure Subscription ID. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.CognitiveServicesManagementClientOptions) { + super(credentials, subscriptionId, options); + this.accounts = new operations.Accounts(this); + this.resourceSkus = new operations.ResourceSkus(this); + this.operations = new operations.Operations(this); + this.checkSkuAvailability = new operations.CheckSkuAvailability(this); + } +} + +// Operation Specifications + +export { + CognitiveServicesManagementClient, + CognitiveServicesManagementClientContext, + Models as CognitiveServicesManagementModels, + Mappers as CognitiveServicesManagementMappers +}; +export * from "./operations"; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/cognitiveServicesManagementClientContext.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/cognitiveServicesManagementClientContext.ts new file mode 100644 index 000000000000..c4b470ae4a90 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/cognitiveServicesManagementClientContext.ts @@ -0,0 +1,62 @@ +/* + * 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 Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; + +const packageName = "@azure/arm-cognitiveservices"; +const packageVersion = "2.4.2"; + +export class CognitiveServicesManagementClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + subscriptionId: string; + apiVersion?: string; + + /** + * Initializes a new instance of the CognitiveServicesManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId Azure Subscription ID. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.CognitiveServicesManagementClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2017-04-18'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/accountsMappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/accountsMappers.ts new file mode 100644 index 000000000000..d5388a42dcc9 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/accountsMappers.ts @@ -0,0 +1,28 @@ +/* + * 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 { + CognitiveServicesAccountCreateParameters, + Sku, + CognitiveServicesAccount, + BaseResource, + ErrorModel, + ErrorBody, + CognitiveServicesAccountUpdateParameters, + CognitiveServicesAccountListResult, + CognitiveServicesAccountKeys, + RegenerateKeyParameters, + CognitiveServicesAccountEnumerateSkusResult, + CognitiveServicesResourceAndSku, + UsagesResult, + Usage, + MetricName +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/checkSkuAvailabilityMappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/checkSkuAvailabilityMappers.ts new file mode 100644 index 000000000000..09fb2cdb1a08 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/checkSkuAvailabilityMappers.ts @@ -0,0 +1,17 @@ +/* + * 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 { + CheckSkuAvailabilityParameter, + CheckSkuAvailabilityResultList, + CheckSkuAvailabilityResult, + CloudError +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/index.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/index.ts new file mode 100644 index 000000000000..9f2c7b1d4ce0 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/index.ts @@ -0,0 +1,1049 @@ +/* + * 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 { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + + +/** + * @interface + * An interface representing Sku. + * The SKU of the cognitive services account. + * + */ +export interface Sku { + /** + * @member {string} name Gets or sets the sku name. Required for account + * creation, optional for update. + */ + name: string; + /** + * @member {SkuTier} [tier] Gets the sku tier. This is based on the SKU name. + * Possible values include: 'Free', 'Standard', 'Premium' + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly tier?: SkuTier; +} + +/** + * @interface + * An interface representing CognitiveServicesAccountCreateParameters. + * The parameters to provide for the account. + * + */ +export interface CognitiveServicesAccountCreateParameters { + /** + * @member {Sku} sku Required. Gets or sets the SKU of the resource. + */ + sku: Sku; + /** + * @member {string} kind Required. Gets or sets the Kind of the resource. + */ + kind: string; + /** + * @member {string} location Required. Gets or sets the location of the + * resource. This will be one of the supported and registered Azure Geo + * Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a + * resource cannot be changed once it is created, but if an identical geo + * region is specified on update the request will succeed. + */ + location: string; + /** + * @member {{ [propertyName: string]: string }} [tags] Gets or sets a list of + * key value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of + * 15 tags can be provided for a resource. Each tag must have a key no + * greater than 128 characters and value no greater than 256 characters. + */ + tags?: { [propertyName: string]: string }; + /** + * @member {any} properties Must exist in the request. Must be an empty + * object. Must not be null. + */ + properties: any; +} + +/** + * @interface + * An interface representing CognitiveServicesAccountUpdateParameters. + * The parameters to provide for the account. + * + */ +export interface CognitiveServicesAccountUpdateParameters { + /** + * @member {Sku} [sku] Gets or sets the SKU of the resource. + */ + sku?: Sku; + /** + * @member {{ [propertyName: string]: string }} [tags] Gets or sets a list of + * key value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of + * 15 tags can be provided for a resource. Each tag must have a key no + * greater than 128 characters and value no greater than 256 characters. + */ + tags?: { [propertyName: string]: string }; + /** + * @member {any} [properties] Additional properties for Account. Only + * provided fields will be updated. + */ + properties?: any; +} + +/** + * @interface + * An interface representing CognitiveServicesAccount. + * Cognitive Services Account is an Azure resource representing the provisioned + * account, its type, location and SKU. + * + * @extends BaseResource + */ +export interface CognitiveServicesAccount extends BaseResource { + /** + * @member {string} [etag] Entity Tag + */ + etag?: string; + /** + * @member {string} [id] The id of the created account + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [kind] Type of cognitive service account. + */ + kind?: string; + /** + * @member {string} [location] The location of the resource + */ + location?: string; + /** + * @member {string} [name] The name of the created account + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {ProvisioningState} [provisioningState] Gets the status of the + * cognitive services account at the time the operation was called. Possible + * values include: 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', + * 'Succeeded', 'Failed' + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly provisioningState?: ProvisioningState; + /** + * @member {string} [endpoint] Endpoint of the created account. + */ + endpoint?: string; + /** + * @member {string} [internalId] The internal identifier. + */ + internalId?: string; + /** + * @member {string} [customSubDomainName] Optional subdomain name used for + * token-based authentication. + */ + customSubDomainName?: string; + /** + * @member {Sku} [sku] The SKU of Cognitive Services account. + */ + sku?: Sku; + /** + * @member {{ [propertyName: string]: string }} [tags] Gets or sets a list of + * key value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of + * 15 tags can be provided for a resource. Each tag must have a key no + * greater than 128 characters and value no greater than 256 characters. + */ + tags?: { [propertyName: string]: string }; + /** + * @member {string} [type] Resource type + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; +} + +/** + * @interface + * An interface representing CognitiveServicesAccountKeys. + * The access keys for the cognitive services account. + * + */ +export interface CognitiveServicesAccountKeys { + /** + * @member {string} [key1] Gets the value of key 1. + */ + key1?: string; + /** + * @member {string} [key2] Gets the value of key 2. + */ + key2?: string; +} + +/** + * @interface + * An interface representing RegenerateKeyParameters. + * Regenerate key parameters. + * + */ +export interface RegenerateKeyParameters { + /** + * @member {KeyName} keyName key name to generate (Key1|Key2). Possible + * values include: 'Key1', 'Key2' + */ + keyName: KeyName; +} + +/** + * @interface + * An interface representing CognitiveServicesResourceAndSku. + * Cognitive Services resource type and SKU. + * + */ +export interface CognitiveServicesResourceAndSku { + /** + * @member {string} [resourceType] Resource Namespace and Type + */ + resourceType?: string; + /** + * @member {Sku} [sku] The SKU of Cognitive Services account. + */ + sku?: Sku; +} + +/** + * @interface + * An interface representing CognitiveServicesAccountEnumerateSkusResult. + * The list of cognitive services accounts operation response. + * + */ +export interface CognitiveServicesAccountEnumerateSkusResult { + /** + * @member {CognitiveServicesResourceAndSku[]} [value] Gets the list of + * Cognitive Services accounts and their properties. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly value?: CognitiveServicesResourceAndSku[]; +} + +/** + * @interface + * An interface representing MetricName. + * A metric name. + * + */ +export interface MetricName { + /** + * @member {string} [value] The name of the metric. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly value?: string; + /** + * @member {string} [localizedValue] The friendly name of the metric. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly localizedValue?: string; +} + +/** + * @interface + * An interface representing Usage. + * The usage data for a usage request. + * + */ +export interface Usage { + /** + * @member {UnitType} [unit] The unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', + * 'BytesPerSecond', 'Milliseconds' + */ + unit?: UnitType; + /** + * @member {MetricName} [name] The name information for the metric. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: MetricName; + /** + * @member {string} [quotaPeriod] The quota period used to summarize the + * usage values. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly quotaPeriod?: string; + /** + * @member {number} [limit] Maximum value for this metric. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly limit?: number; + /** + * @member {number} [currentValue] Current value for this metric. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly currentValue?: number; + /** + * @member {string} [nextResetTime] Next reset time for current quota. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly nextResetTime?: string; + /** + * @member {QuotaUsageStatus} [status] Cognitive Services account quota usage + * status. Possible values include: 'Included', 'Blocked', 'InOverage', + * 'Unknown' + */ + status?: QuotaUsageStatus; +} + +/** + * @interface + * An interface representing UsagesResult. + * The response to a list usage request. + * + */ +export interface UsagesResult { + /** + * @member {Usage[]} [value] The list of usages for Cognitive Service + * account. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly value?: Usage[]; +} + +/** + * @interface + * An interface representing ErrorBody. + * Cognitive Services error body. + * + */ +export interface ErrorBody { + /** + * @member {string} code error code + */ + code: string; + /** + * @member {string} message error message + */ + message: string; +} + +/** + * @interface + * An interface representing ErrorModel. + * Cognitive Services error object. + * + */ +export interface ErrorModel { + /** + * @member {ErrorBody} [error] The error body. + */ + error?: ErrorBody; +} + +/** + * @interface + * An interface representing OperationDisplayInfo. + * The operation supported by Cognitive Services. + * + */ +export interface OperationDisplayInfo { + /** + * @member {string} [description] The description of the operation. + */ + description?: string; + /** + * @member {string} [operation] The action that users can perform, based on + * their permission level. + */ + operation?: string; + /** + * @member {string} [provider] Service provider: Microsoft Cognitive + * Services. + */ + provider?: string; + /** + * @member {string} [resource] Resource on which the operation is performed. + */ + resource?: string; +} + +/** + * @interface + * An interface representing OperationEntity. + * The operation supported by Cognitive Services. + * + */ +export interface OperationEntity { + /** + * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + */ + name?: string; + /** + * @member {OperationDisplayInfo} [display] The operation supported by + * Cognitive Services. + */ + display?: OperationDisplayInfo; + /** + * @member {string} [origin] The origin of the operation. + */ + origin?: string; + /** + * @member {any} [properties] Additional properties. + */ + properties?: any; +} + +/** + * @interface + * An interface representing CheckSkuAvailabilityParameter. + * Check SKU availability parameter. + * + */ +export interface CheckSkuAvailabilityParameter { + /** + * @member {string[]} skus The SKU of the resource. + */ + skus: string[]; + /** + * @member {string} kind The Kind of the resource. + */ + kind: string; + /** + * @member {string} type The Type of the resource. + */ + type: string; +} + +/** + * @interface + * An interface representing CheckSkuAvailabilityResult. + * Check SKU availability result. + * + */ +export interface CheckSkuAvailabilityResult { + /** + * @member {string} [kind] The Kind of the resource. + */ + kind?: string; + /** + * @member {string} [type] The Type of the resource. + */ + type?: string; + /** + * @member {string} [skuName] The SKU of Cognitive Services account. + */ + skuName?: string; + /** + * @member {boolean} [skuAvailable] Indicates the given SKU is available or + * not. + */ + skuAvailable?: boolean; + /** + * @member {string} [reason] Reason why the SKU is not available. + */ + reason?: string; + /** + * @member {string} [message] Additional error message. + */ + message?: string; +} + +/** + * @interface + * An interface representing CheckSkuAvailabilityResultList. + * Check SKU availability result list. + * + */ +export interface CheckSkuAvailabilityResultList { + /** + * @member {CheckSkuAvailabilityResult[]} [value] Check SKU availability + * result list. + */ + value?: CheckSkuAvailabilityResult[]; +} + +/** + * @interface + * An interface representing ResourceSkuRestrictionInfo. + */ +export interface ResourceSkuRestrictionInfo { + /** + * @member {string[]} [locations] Locations where the SKU is restricted + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly locations?: string[]; + /** + * @member {string[]} [zones] List of availability zones where the SKU is + * restricted. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly zones?: string[]; +} + +/** + * @interface + * An interface representing ResourceSkuRestrictions. + * Describes restrictions of a SKU. + * + */ +export interface ResourceSkuRestrictions { + /** + * @member {ResourceSkuRestrictionsType} [type] The type of restrictions. + * Possible values include: 'Location', 'Zone' + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: ResourceSkuRestrictionsType; + /** + * @member {string[]} [values] The value of restrictions. If the restriction + * type is set to location. This would be different locations where the SKU + * is restricted. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly values?: string[]; + /** + * @member {ResourceSkuRestrictionInfo} [restrictionInfo] The information + * about the restriction where the SKU cannot be used. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly restrictionInfo?: ResourceSkuRestrictionInfo; + /** + * @member {ResourceSkuRestrictionsReasonCode} [reasonCode] The reason for + * restriction. Possible values include: 'QuotaId', + * 'NotAvailableForSubscription' + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly reasonCode?: ResourceSkuRestrictionsReasonCode; +} + +/** + * @interface + * An interface representing ResourceSku. + * Describes an available Cognitive Services SKU. + * + */ +export interface ResourceSku { + /** + * @member {string} [resourceType] The type of resource the SKU applies to. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly resourceType?: string; + /** + * @member {string} [name] The name of SKU. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; + /** + * @member {string} [tier] Specifies the tier of Cognitive Services account. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly tier?: string; + /** + * @member {string} [kind] The Kind of resources that are supported in this + * SKU. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly kind?: string; + /** + * @member {string[]} [locations] The set of locations that the SKU is + * available. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly locations?: string[]; + /** + * @member {ResourceSkuRestrictions[]} [restrictions] The restrictions + * because of which SKU cannot be used. This is empty if there are no + * restrictions. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly restrictions?: ResourceSkuRestrictions[]; +} + +/** + * @interface + * An interface representing AccountsUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface AccountsUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {Sku} [sku] Gets or sets the SKU of the resource. + */ + sku?: Sku; + /** + * @member {{ [propertyName: string]: string }} [tags] Gets or sets a list of + * key value pairs that describe the resource. These tags can be used in + * viewing and grouping this resource (across resource groups). A maximum of + * 15 tags can be provided for a resource. Each tag must have a key no + * greater than 128 characters and value no greater than 256 characters. + */ + tags?: { [propertyName: string]: string }; + /** + * @member {any} [properties] Additional properties for Account. Only + * provided fields will be updated. + */ + properties?: any; +} + +/** + * @interface + * An interface representing AccountsGetUsagesOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface AccountsGetUsagesOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [filter] An OData filter expression that describes a + * subset of usages to return. The supported parameter is name.value (name of + * the metric, can have an or of multiple names). + */ + filter?: string; +} + +/** + * @interface + * An interface representing CognitiveServicesManagementClientOptions. + * @extends AzureServiceClientOptions + */ +export interface CognitiveServicesManagementClientOptions extends AzureServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + + +/** + * @interface + * An interface representing the CognitiveServicesAccountListResult. + * The list of cognitive services accounts operation response. + * + * @extends Array + */ +export interface CognitiveServicesAccountListResult extends Array { + /** + * @member {string} [nextLink] The link used to get the next page of + * accounts. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the ResourceSkusResult. + * The Get Skus operation response. + * + * @extends Array + */ +export interface ResourceSkusResult extends Array { + /** + * @member {string} [nextLink] The uri to fetch the next page of Skus. + */ + nextLink?: string; +} + +/** + * @interface + * An interface representing the OperationEntityListResult. + * The list of cognitive services accounts operation response. + * + * @extends Array + */ +export interface OperationEntityListResult extends Array { + /** + * @member {string} [nextLink] The link used to get the next page of + * operations. + */ + nextLink?: string; +} + +/** + * Defines values for SkuTier. + * Possible values include: 'Free', 'Standard', 'Premium' + * @readonly + * @enum {string} + */ +export type SkuTier = 'Free' | 'Standard' | 'Premium'; + +/** + * Defines values for ProvisioningState. + * Possible values include: 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed' + * @readonly + * @enum {string} + */ +export type ProvisioningState = 'Creating' | 'ResolvingDNS' | 'Moving' | 'Deleting' | 'Succeeded' | 'Failed'; + +/** + * Defines values for KeyName. + * Possible values include: 'Key1', 'Key2' + * @readonly + * @enum {string} + */ +export type KeyName = 'Key1' | 'Key2'; + +/** + * Defines values for UnitType. + * Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', + * 'BytesPerSecond', 'Milliseconds' + * @readonly + * @enum {string} + */ +export type UnitType = 'Count' | 'Bytes' | 'Seconds' | 'Percent' | 'CountPerSecond' | 'BytesPerSecond' | 'Milliseconds'; + +/** + * Defines values for QuotaUsageStatus. + * Possible values include: 'Included', 'Blocked', 'InOverage', 'Unknown' + * @readonly + * @enum {string} + */ +export type QuotaUsageStatus = 'Included' | 'Blocked' | 'InOverage' | 'Unknown'; + +/** + * Defines values for ResourceSkuRestrictionsType. + * Possible values include: 'Location', 'Zone' + * @readonly + * @enum {string} + */ +export type ResourceSkuRestrictionsType = 'Location' | 'Zone'; + +/** + * Defines values for ResourceSkuRestrictionsReasonCode. + * Possible values include: 'QuotaId', 'NotAvailableForSubscription' + * @readonly + * @enum {string} + */ +export type ResourceSkuRestrictionsReasonCode = 'QuotaId' | 'NotAvailableForSubscription'; + +/** + * Contains response data for the create operation. + */ +export type AccountsCreateResponse = CognitiveServicesAccount & { + /** + * 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: CognitiveServicesAccount; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type AccountsUpdateResponse = CognitiveServicesAccount & { + /** + * 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: CognitiveServicesAccount; + }; +}; + +/** + * Contains response data for the getProperties operation. + */ +export type AccountsGetPropertiesResponse = CognitiveServicesAccount & { + /** + * 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: CognitiveServicesAccount; + }; +}; + +/** + * Contains response data for the listByResourceGroup operation. + */ +export type AccountsListByResourceGroupResponse = CognitiveServicesAccountListResult & { + /** + * 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: CognitiveServicesAccountListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type AccountsListResponse = CognitiveServicesAccountListResult & { + /** + * 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: CognitiveServicesAccountListResult; + }; +}; + +/** + * Contains response data for the listKeys operation. + */ +export type AccountsListKeysResponse = CognitiveServicesAccountKeys & { + /** + * 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: CognitiveServicesAccountKeys; + }; +}; + +/** + * Contains response data for the regenerateKey operation. + */ +export type AccountsRegenerateKeyResponse = CognitiveServicesAccountKeys & { + /** + * 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: CognitiveServicesAccountKeys; + }; +}; + +/** + * Contains response data for the listSkus operation. + */ +export type AccountsListSkusResponse = CognitiveServicesAccountEnumerateSkusResult & { + /** + * 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: CognitiveServicesAccountEnumerateSkusResult; + }; +}; + +/** + * Contains response data for the getUsages operation. + */ +export type AccountsGetUsagesResponse = UsagesResult & { + /** + * 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: UsagesResult; + }; +}; + +/** + * Contains response data for the listByResourceGroupNext operation. + */ +export type AccountsListByResourceGroupNextResponse = CognitiveServicesAccountListResult & { + /** + * 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: CognitiveServicesAccountListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type AccountsListNextResponse = CognitiveServicesAccountListResult & { + /** + * 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: CognitiveServicesAccountListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ResourceSkusListResponse = ResourceSkusResult & { + /** + * 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: ResourceSkusResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ResourceSkusListNextResponse = ResourceSkusResult & { + /** + * 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: ResourceSkusResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationEntityListResult & { + /** + * 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: OperationEntityListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type OperationsListNextResponse = OperationEntityListResult & { + /** + * 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: OperationEntityListResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type CheckSkuAvailabilityListResponse = CheckSkuAvailabilityResultList & { + /** + * 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: CheckSkuAvailabilityResultList; + }; +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/mappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/mappers.ts new file mode 100644 index 000000000000..b03853df2e01 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/mappers.ts @@ -0,0 +1,859 @@ +/* + * 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const Sku: msRest.CompositeMapper = { + serializedName: "Sku", + type: { + name: "Composite", + className: "Sku", + modelProperties: { + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + tier: { + readOnly: true, + serializedName: "tier", + type: { + name: "Enum", + allowedValues: [ + "Free", + "Standard", + "Premium" + ] + } + } + } + } +}; + +export const CognitiveServicesAccountCreateParameters: msRest.CompositeMapper = { + serializedName: "CognitiveServicesAccountCreateParameters", + type: { + name: "Composite", + className: "CognitiveServicesAccountCreateParameters", + modelProperties: { + sku: { + required: true, + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + kind: { + required: true, + serializedName: "kind", + type: { + name: "String" + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + properties: { + required: true, + serializedName: "properties", + type: { + name: "Object" + } + } + } + } +}; + +export const CognitiveServicesAccountUpdateParameters: msRest.CompositeMapper = { + serializedName: "CognitiveServicesAccountUpdateParameters", + type: { + name: "Composite", + className: "CognitiveServicesAccountUpdateParameters", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + } + } + } +}; + +export const CognitiveServicesAccount: msRest.CompositeMapper = { + serializedName: "CognitiveServicesAccount", + type: { + name: "Composite", + className: "CognitiveServicesAccount", + modelProperties: { + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + kind: { + serializedName: "kind", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + provisioningState: { + readOnly: true, + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + endpoint: { + serializedName: "properties.endpoint", + type: { + name: "String" + } + }, + internalId: { + serializedName: "properties.internalId", + type: { + name: "String" + } + }, + customSubDomainName: { + serializedName: "properties.customSubDomainName", + type: { + name: "String" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CognitiveServicesAccountKeys: msRest.CompositeMapper = { + serializedName: "CognitiveServicesAccountKeys", + type: { + name: "Composite", + className: "CognitiveServicesAccountKeys", + modelProperties: { + key1: { + serializedName: "key1", + type: { + name: "String" + } + }, + key2: { + serializedName: "key2", + type: { + name: "String" + } + } + } + } +}; + +export const RegenerateKeyParameters: msRest.CompositeMapper = { + serializedName: "RegenerateKeyParameters", + type: { + name: "Composite", + className: "RegenerateKeyParameters", + modelProperties: { + keyName: { + required: true, + serializedName: "keyName", + type: { + name: "Enum", + allowedValues: [ + "Key1", + "Key2" + ] + } + } + } + } +}; + +export const CognitiveServicesResourceAndSku: msRest.CompositeMapper = { + serializedName: "CognitiveServicesResourceAndSku", + type: { + name: "Composite", + className: "CognitiveServicesResourceAndSku", + modelProperties: { + resourceType: { + serializedName: "resourceType", + type: { + name: "String" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + } + } + } +}; + +export const CognitiveServicesAccountEnumerateSkusResult: msRest.CompositeMapper = { + serializedName: "CognitiveServicesAccountEnumerateSkusResult", + type: { + name: "Composite", + className: "CognitiveServicesAccountEnumerateSkusResult", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CognitiveServicesResourceAndSku" + } + } + } + } + } + } +}; + +export const MetricName: msRest.CompositeMapper = { + serializedName: "MetricName", + type: { + name: "Composite", + className: "MetricName", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", + type: { + name: "String" + } + }, + localizedValue: { + readOnly: true, + serializedName: "localizedValue", + type: { + name: "String" + } + } + } + } +}; + +export const Usage: msRest.CompositeMapper = { + serializedName: "Usage", + type: { + name: "Composite", + className: "Usage", + modelProperties: { + unit: { + serializedName: "unit", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "Composite", + className: "MetricName" + } + }, + quotaPeriod: { + readOnly: true, + serializedName: "quotaPeriod", + type: { + name: "String" + } + }, + limit: { + readOnly: true, + serializedName: "limit", + type: { + name: "Number" + } + }, + currentValue: { + readOnly: true, + serializedName: "currentValue", + type: { + name: "Number" + } + }, + nextResetTime: { + readOnly: true, + serializedName: "nextResetTime", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const UsagesResult: msRest.CompositeMapper = { + serializedName: "UsagesResult", + type: { + name: "Composite", + className: "UsagesResult", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Usage" + } + } + } + } + } + } +}; + +export const ErrorBody: msRest.CompositeMapper = { + serializedName: "ErrorBody", + type: { + name: "Composite", + className: "ErrorBody", + modelProperties: { + code: { + required: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + required: true, + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorModel: msRest.CompositeMapper = { + serializedName: "Error", + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorBody" + } + } + } + } +}; + +export const OperationDisplayInfo: msRest.CompositeMapper = { + serializedName: "OperationDisplayInfo", + type: { + name: "Composite", + className: "OperationDisplayInfo", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + } + } + } +}; + +export const OperationEntity: msRest.CompositeMapper = { + serializedName: "OperationEntity", + type: { + name: "Composite", + className: "OperationEntity", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplayInfo" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + } + } + } +}; + +export const CheckSkuAvailabilityParameter: msRest.CompositeMapper = { + serializedName: "CheckSkuAvailabilityParameter", + type: { + name: "Composite", + className: "CheckSkuAvailabilityParameter", + modelProperties: { + skus: { + required: true, + serializedName: "skus", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + kind: { + required: true, + serializedName: "kind", + type: { + name: "String" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckSkuAvailabilityResult: msRest.CompositeMapper = { + serializedName: "CheckSkuAvailabilityResult", + type: { + name: "Composite", + className: "CheckSkuAvailabilityResult", + modelProperties: { + kind: { + serializedName: "kind", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + skuName: { + serializedName: "skuName", + type: { + name: "String" + } + }, + skuAvailable: { + serializedName: "skuAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const CheckSkuAvailabilityResultList: msRest.CompositeMapper = { + serializedName: "CheckSkuAvailabilityResultList", + type: { + name: "Composite", + className: "CheckSkuAvailabilityResultList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CheckSkuAvailabilityResult" + } + } + } + } + } + } +}; + +export const ResourceSkuRestrictionInfo: msRest.CompositeMapper = { + serializedName: "ResourceSkuRestrictionInfo", + type: { + name: "Composite", + className: "ResourceSkuRestrictionInfo", + modelProperties: { + locations: { + readOnly: true, + serializedName: "locations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + zones: { + readOnly: true, + serializedName: "zones", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ResourceSkuRestrictions: msRest.CompositeMapper = { + serializedName: "ResourceSkuRestrictions", + type: { + name: "Composite", + className: "ResourceSkuRestrictions", + modelProperties: { + type: { + readOnly: true, + serializedName: "type", + type: { + name: "Enum", + allowedValues: [ + "Location", + "Zone" + ] + } + }, + values: { + readOnly: true, + serializedName: "values", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + restrictionInfo: { + readOnly: true, + serializedName: "restrictionInfo", + type: { + name: "Composite", + className: "ResourceSkuRestrictionInfo" + } + }, + reasonCode: { + readOnly: true, + serializedName: "reasonCode", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceSku: msRest.CompositeMapper = { + serializedName: "ResourceSku", + type: { + name: "Composite", + className: "ResourceSku", + modelProperties: { + resourceType: { + readOnly: true, + serializedName: "resourceType", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + tier: { + readOnly: true, + serializedName: "tier", + type: { + name: "String" + } + }, + kind: { + readOnly: true, + serializedName: "kind", + type: { + name: "String" + } + }, + locations: { + readOnly: true, + serializedName: "locations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + restrictions: { + readOnly: true, + serializedName: "restrictions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSkuRestrictions" + } + } + } + } + } + } +}; + +export const CognitiveServicesAccountListResult: msRest.CompositeMapper = { + serializedName: "CognitiveServicesAccountListResult", + type: { + name: "Composite", + className: "CognitiveServicesAccountListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + readOnly: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CognitiveServicesAccount" + } + } + } + } + } + } +}; + +export const ResourceSkusResult: msRest.CompositeMapper = { + serializedName: "ResourceSkusResult", + type: { + name: "Composite", + className: "ResourceSkusResult", + modelProperties: { + value: { + required: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSku" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationEntityListResult: msRest.CompositeMapper = { + serializedName: "OperationEntityListResult", + type: { + name: "Composite", + className: "OperationEntityListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationEntity" + } + } + } + } + } + } +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/operationsMappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/operationsMappers.ts new file mode 100644 index 000000000000..aba5d8bf047b --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/operationsMappers.ts @@ -0,0 +1,17 @@ +/* + * 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 { + OperationEntityListResult, + OperationEntity, + OperationDisplayInfo, + CloudError +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/parameters.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/parameters.ts new file mode 100644 index 000000000000..6d8020a2396a --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/parameters.ts @@ -0,0 +1,100 @@ +/* + * 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"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const accountName: msRest.OperationURLParameter = { + parameterPath: "accountName", + mapper: { + required: true, + serializedName: "accountName", + constraints: { + MaxLength: 64, + MinLength: 2, + Pattern: /^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/ + }, + type: { + name: "String" + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; +export const filter: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "filter" + ], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; +export const location: msRest.OperationURLParameter = { + parameterPath: "location", + mapper: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const resourceGroupName: msRest.OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + required: true, + serializedName: "resourceGroupName", + type: { + name: "String" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/models/resourceSkusMappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/resourceSkusMappers.ts new file mode 100644 index 000000000000..6b769892ecce --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/models/resourceSkusMappers.ts @@ -0,0 +1,18 @@ +/* + * 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 { + ResourceSkusResult, + ResourceSku, + ResourceSkuRestrictions, + ResourceSkuRestrictionInfo, + CloudError +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/accounts.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/accounts.ts new file mode 100644 index 000000000000..92c5cf1ecac1 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/accounts.ts @@ -0,0 +1,731 @@ +/* + * 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/accountsMappers"; +import * as Parameters from "../models/parameters"; +import { CognitiveServicesManagementClientContext } from "../cognitiveServicesManagementClientContext"; + +/** Class representing a Accounts. */ +export class Accounts { + private readonly client: CognitiveServicesManagementClientContext; + + /** + * Create a Accounts. + * @param {CognitiveServicesManagementClientContext} client Reference to the service client. + */ + constructor(client: CognitiveServicesManagementClientContext) { + this.client = client; + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the + * keys for developer to access intelligent APIs. It's also the resource type for billing. + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created account. + * @param [options] The optional parameters + * @returns Promise + */ + create(resourceGroupName: string, accountName: string, parameters: Models.CognitiveServicesAccountCreateParameters, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created account. + * @param callback The callback + */ + create(resourceGroupName: string, accountName: string, parameters: Models.CognitiveServicesAccountCreateParameters, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created account. + * @param options The optional parameters + * @param callback The callback + */ + create(resourceGroupName: string, accountName: string, parameters: Models.CognitiveServicesAccountCreateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + create(resourceGroupName: string, accountName: string, parameters: Models.CognitiveServicesAccountCreateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + parameters, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * Updates a Cognitive Services account + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceGroupName: string, accountName: string, options?: Models.AccountsUpdateOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param callback The callback + */ + update(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param options The optional parameters + * @param callback The callback + */ + update(resourceGroupName: string, accountName: string, options: Models.AccountsUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, accountName: string, options?: Models.AccountsUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + options + }, + updateOperationSpec, + callback) as Promise; + } + + /** + * Deletes a Cognitive Services account from the resource group. + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param callback The callback + */ + deleteMethod(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(resourceGroupName: string, accountName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param [options] The optional parameters + * @returns Promise + */ + getProperties(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param callback The callback + */ + getProperties(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param options The optional parameters + * @param callback The callback + */ + getProperties(resourceGroupName: string, accountName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getProperties(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + options + }, + getPropertiesOperationSpec, + callback) as Promise; + } + + /** + * Returns all the resources of a particular type belonging to a resource group + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param [options] The optional parameters + * @returns Promise + */ + listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param callback The callback + */ + listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @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; + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * @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; + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param [options] The optional parameters + * @returns Promise + */ + listKeys(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param callback The callback + */ + listKeys(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param options The optional parameters + * @param callback The callback + */ + listKeys(resourceGroupName: string, accountName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listKeys(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + options + }, + listKeysOperationSpec, + callback) as Promise; + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @param [options] The optional parameters + * @returns Promise + */ + regenerateKey(resourceGroupName: string, accountName: string, keyName: Models.KeyName, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @param callback The callback + */ + regenerateKey(resourceGroupName: string, accountName: string, keyName: Models.KeyName, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @param options The optional parameters + * @param callback The callback + */ + regenerateKey(resourceGroupName: string, accountName: string, keyName: Models.KeyName, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + regenerateKey(resourceGroupName: string, accountName: string, keyName: Models.KeyName, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + keyName, + options + }, + regenerateKeyOperationSpec, + callback) as Promise; + } + + /** + * List available SKUs for the requested Cognitive Services account + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param [options] The optional parameters + * @returns Promise + */ + listSkus(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param callback The callback + */ + listSkus(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param options The optional parameters + * @param callback The callback + */ + listSkus(resourceGroupName: string, accountName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listSkus(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + options + }, + listSkusOperationSpec, + callback) as Promise; + } + + /** + * Get usages for the requested Cognitive Services account + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param [options] The optional parameters + * @returns Promise + */ + getUsages(resourceGroupName: string, accountName: string, options?: Models.AccountsGetUsagesOptionalParams): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param callback The callback + */ + getUsages(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param options The optional parameters + * @param callback The callback + */ + getUsages(resourceGroupName: string, accountName: string, options: Models.AccountsGetUsagesOptionalParams, callback: msRest.ServiceCallback): void; + getUsages(resourceGroupName: string, accountName: string, options?: Models.AccountsGetUsagesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + accountName, + options + }, + getUsagesOperationSpec, + callback) as Promise; + } + + /** + * Returns all the resources of a particular type belonging to 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; + } + + /** + * Returns all the resources of a particular type belonging to a subscription. + * @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 createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "parameters", + mapper: { + ...Mappers.CognitiveServicesAccountCreateParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccount + }, + 201: { + bodyMapper: Mappers.CognitiveServicesAccount + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + sku: [ + "options", + "sku" + ], + tags: [ + "options", + "tags" + ], + properties: [ + "options", + "properties" + ] + }, + mapper: { + ...Mappers.CognitiveServicesAccountUpdateParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccount + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const getPropertiesOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccount + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listByResourceGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listKeysOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountKeys + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const regenerateKeyOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + keyName: "keyName" + }, + mapper: { + ...Mappers.RegenerateKeyParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountKeys + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listSkusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountEnumerateSkusResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const getUsagesOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.accountName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.filter + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.UsagesResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CognitiveServicesAccountListResult + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/checkSkuAvailability.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/checkSkuAvailability.ts new file mode 100644 index 000000000000..2d8e33bcd896 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/checkSkuAvailability.ts @@ -0,0 +1,105 @@ +/* + * 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/checkSkuAvailabilityMappers"; +import * as Parameters from "../models/parameters"; +import { CognitiveServicesManagementClientContext } from "../cognitiveServicesManagementClientContext"; + +/** Class representing a CheckSkuAvailability. */ +export class CheckSkuAvailability { + private readonly client: CognitiveServicesManagementClientContext; + + /** + * Create a CheckSkuAvailability. + * @param {CognitiveServicesManagementClientContext} client Reference to the service client. + */ + constructor(client: CognitiveServicesManagementClientContext) { + this.client = client; + } + + /** + * Check available SKUs. + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type of the resource. + * @param [options] The optional parameters + * @returns Promise + */ + list(location: string, skus: string[], kind: string, type: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type of the resource. + * @param callback The callback + */ + list(location: string, skus: string[], kind: string, type: string, callback: msRest.ServiceCallback): void; + /** + * @param location Resource location. + * @param skus The SKU of the resource. + * @param kind The Kind of the resource. + * @param type The Type of the resource. + * @param options The optional parameters + * @param callback The callback + */ + list(location: string, skus: string[], kind: string, type: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(location: string, skus: string[], kind: string, type: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + location, + skus, + kind, + type, + options + }, + listOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability", + urlParameters: [ + Parameters.subscriptionId, + Parameters.location + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + skus: "skus", + kind: "kind", + type: "type" + }, + mapper: { + ...Mappers.CheckSkuAvailabilityParameter, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CheckSkuAvailabilityResultList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/index.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/index.ts new file mode 100644 index 000000000000..d4af4c0dda51 --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/index.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 * from "./accounts"; +export * from "./resourceSkus"; +export * from "./operations"; +export * from "./checkSkuAvailability"; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/operations.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/operations.ts new file mode 100644 index 000000000000..9e57c374363d --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/operations.ts @@ -0,0 +1,123 @@ +/* + * 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/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { CognitiveServicesManagementClientContext } from "../cognitiveServicesManagementClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: CognitiveServicesManagementClientContext; + + /** + * Create a Operations. + * @param {CognitiveServicesManagementClientContext} client Reference to the service client. + */ + constructor(client: CognitiveServicesManagementClientContext) { + this.client = client; + } + + /** + * Lists all the available Cognitive Services account operations. + * @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; + } + + /** + * Lists all the available Cognitive Services account operations. + * @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 listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.CognitiveServices/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationEntityListResult + }, + 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.OperationEntityListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/resourceSkus.ts b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/resourceSkus.ts new file mode 100644 index 000000000000..b3bba5e8356d --- /dev/null +++ b/sdk/cognitiveservices/arm-cognitiveservices/lib/operations/resourceSkus.ts @@ -0,0 +1,126 @@ +/* + * 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/resourceSkusMappers"; +import * as Parameters from "../models/parameters"; +import { CognitiveServicesManagementClientContext } from "../cognitiveServicesManagementClientContext"; + +/** Class representing a ResourceSkus. */ +export class ResourceSkus { + private readonly client: CognitiveServicesManagementClientContext; + + /** + * Create a ResourceSkus. + * @param {CognitiveServicesManagementClientContext} client Reference to the service client. + */ + constructor(client: CognitiveServicesManagementClientContext) { + this.client = client; + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. + * @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; + } + + /** + * Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. + * @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 listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ResourceSkusResult + }, + 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.ResourceSkusResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/package.json b/sdk/cognitiveservices/arm-cognitiveservices/package.json index dacb0836ddd5..a0d15adb9967 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/package.json +++ b/sdk/cognitiveservices/arm-cognitiveservices/package.json @@ -26,7 +26,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, - "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/arm-cognitiveservices", + "homepage": "https://github.com/azure/azure-sdk-for-js", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-js.git" @@ -43,8 +43,7 @@ "esm/**/*.js.map", "esm/**/*.d.ts", "esm/**/*.d.ts.map", - "src/**/*.ts", - "README.md", + "lib/**/*.ts", "rollup.config.js", "tsconfig.json" ], @@ -53,6 +52,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-cognitiveservices.js.map'\" -o ./dist/arm-cognitiveservices.min.js ./dist/arm-cognitiveservices.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "authPublish": true + "sideEffects": false } diff --git a/sdk/cognitiveservices/arm-cognitiveservices/tsconfig.json b/sdk/cognitiveservices/arm-cognitiveservices/tsconfig.json index 87bbf5b5fa49..51ea90961ce5 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/tsconfig.json +++ b/sdk/cognitiveservices/arm-cognitiveservices/tsconfig.json @@ -14,6 +14,6 @@ "outDir": "./esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./lib/**/*.ts"], "exclude": ["node_modules"] }