diff --git a/sdk/cognitiveservices/arm-cognitiveservices/src/cognitiveServicesManagementClient.ts b/sdk/cognitiveservices/arm-cognitiveservices/src/cognitiveServicesManagementClient.ts index e2d721fdca7c..6d87d48815ae 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/src/cognitiveServicesManagementClient.ts +++ b/sdk/cognitiveservices/arm-cognitiveservices/src/cognitiveServicesManagementClient.ts @@ -11,6 +11,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as Models from "./models"; import * as Mappers from "./models/mappers"; +import * as Parameters from "./models/parameters"; import * as operations from "./operations"; import { CognitiveServicesManagementClientContext } from "./cognitiveServicesManagementClientContext"; @@ -35,9 +36,71 @@ class CognitiveServicesManagementClient extends CognitiveServicesManagementClien this.operations = new operations.Operations(this); this.checkSkuAvailability = new operations.CheckSkuAvailability(this); } + + /** + * Check whether a domain is available. + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @param [options] The optional parameters + * @returns Promise + */ + checkDomainAvailability(subdomainName: string, type: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @param callback The callback + */ + checkDomainAvailability(subdomainName: string, type: string, callback: msRest.ServiceCallback): void; + /** + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @param options The optional parameters + * @param callback The callback + */ + checkDomainAvailability(subdomainName: string, type: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + checkDomainAvailability(subdomainName: string, type: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + subdomainName, + type, + options + }, + checkDomainAvailabilityOperationSpec, + callback) as Promise; + } } // Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const checkDomainAvailabilityOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.CognitiveServices/checkDomainAvailability", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + subdomainName: "subdomainName", + type: "type" + }, + mapper: { + ...Mappers.CheckDomainAvailabilityParameter, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.CheckDomainAvailabilityResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; export { CognitiveServicesManagementClient, diff --git a/sdk/cognitiveservices/arm-cognitiveservices/src/models/accountsMappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/src/models/accountsMappers.ts index 522047653605..ecb47c3859e7 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/src/models/accountsMappers.ts +++ b/sdk/cognitiveservices/arm-cognitiveservices/src/models/accountsMappers.ts @@ -17,9 +17,12 @@ export { CognitiveServicesResourceAndSku, ErrorBody, ErrorModel, + IpRule, MetricName, + NetworkRuleSet, RegenerateKeyParameters, Sku, Usage, - UsagesResult + UsagesResult, + VirtualNetworkRule } from "../models/mappers"; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/src/models/index.ts b/sdk/cognitiveservices/arm-cognitiveservices/src/models/index.ts index 568e98a8d604..8e0217a4a9e5 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/src/models/index.ts +++ b/sdk/cognitiveservices/arm-cognitiveservices/src/models/index.ts @@ -80,6 +80,60 @@ export interface CognitiveServicesAccountUpdateParameters { properties?: any; } +/** + * A rule governing the accessibility from a specific ip address or ip range. + */ +export interface IpRule { + /** + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + */ + value: string; +} + +/** + * A rule governing the accessibility from a specific virtual network. + */ +export interface VirtualNetworkRule { + /** + * Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + id: string; + /** + * Gets the state of virtual network rule. + */ + state?: string; + /** + * Ignore missing vnet service endpoint or not. + */ + ignoreMissingVnetServiceEndpoint?: boolean; +} + +/** + * A set of rules governing the network accessibility. + */ +export interface NetworkRuleSet { + /** + * Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + * specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None' + */ + bypass?: NetworkRuleBypassOptions; + /** + * The default action when no rule from ipRules and from virtualNetworkRules match. This is only + * used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + */ + defaultAction?: NetworkRuleAction; + /** + * The list of IP address rules. + */ + ipRules?: IpRule[]; + /** + * The list of virtual network rules. + */ + virtualNetworkRules?: VirtualNetworkRule[]; +} + /** * Cognitive Services Account is an Azure resource representing the provisioned account, its type, * location and SKU. @@ -126,6 +180,10 @@ export interface CognitiveServicesAccount extends BaseResource { * Optional subdomain name used for token-based authentication. */ customSubDomainName?: string; + /** + * A collection of rules governing the accessibility from specific network locations. + */ + networkAcls?: NetworkRuleSet; /** * The SKU of Cognitive Services account. */ @@ -387,6 +445,42 @@ export interface CheckSkuAvailabilityResultList { value?: CheckSkuAvailabilityResult[]; } +/** + * Check Domain availability parameter. + */ +export interface CheckDomainAvailabilityParameter { + /** + * The subdomain name to use. + */ + subdomainName: string; + /** + * The Type of the resource. + */ + type: string; +} + +/** + * Check Domain availability result. + */ +export interface CheckDomainAvailabilityResult { + /** + * Indicates the given SKU is available or not. + */ + isSubdomainAvailable?: boolean; + /** + * Reason why the SKU is not available. + */ + reason?: string; + /** + * The subdomain name to use. + */ + subdomainName?: string; + /** + * The Type of the resource. + */ + type?: string; +} + /** * An interface representing ResourceSkuRestrictionInfo. */ @@ -558,6 +652,22 @@ export type SkuTier = 'Free' | 'Standard' | 'Premium'; */ export type ProvisioningState = 'Creating' | 'ResolvingDNS' | 'Moving' | 'Deleting' | 'Succeeded' | 'Failed'; +/** + * Defines values for NetworkRuleBypassOptions. + * Possible values include: 'AzureServices', 'None' + * @readonly + * @enum {string} + */ +export type NetworkRuleBypassOptions = 'AzureServices' | 'None'; + +/** + * Defines values for NetworkRuleAction. + * Possible values include: 'Allow', 'Deny' + * @readonly + * @enum {string} + */ +export type NetworkRuleAction = 'Allow' | 'Deny'; + /** * Defines values for KeyName. * Possible values include: 'Key1', 'Key2' @@ -918,3 +1028,23 @@ export type CheckSkuAvailabilityListResponse = CheckSkuAvailabilityResultList & parsedBody: CheckSkuAvailabilityResultList; }; }; + +/** + * Contains response data for the checkDomainAvailability operation. + */ +export type CheckDomainAvailabilityResponse = CheckDomainAvailabilityResult & { + /** + * 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: CheckDomainAvailabilityResult; + }; +}; diff --git a/sdk/cognitiveservices/arm-cognitiveservices/src/models/mappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/src/models/mappers.ts index 2dd60c875822..e31af7209975 100644 --- a/sdk/cognitiveservices/arm-cognitiveservices/src/models/mappers.ts +++ b/sdk/cognitiveservices/arm-cognitiveservices/src/models/mappers.ts @@ -125,6 +125,98 @@ export const CognitiveServicesAccountUpdateParameters: msRest.CompositeMapper = } }; +export const IpRule: msRest.CompositeMapper = { + serializedName: "IpRule", + type: { + name: "Composite", + className: "IpRule", + modelProperties: { + value: { + required: true, + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const VirtualNetworkRule: msRest.CompositeMapper = { + serializedName: "VirtualNetworkRule", + type: { + name: "Composite", + className: "VirtualNetworkRule", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + state: { + serializedName: "state", + type: { + name: "String" + } + }, + ignoreMissingVnetServiceEndpoint: { + serializedName: "ignoreMissingVnetServiceEndpoint", + type: { + name: "Boolean" + } + } + } + } +}; + +export const NetworkRuleSet: msRest.CompositeMapper = { + serializedName: "NetworkRuleSet", + type: { + name: "Composite", + className: "NetworkRuleSet", + modelProperties: { + bypass: { + serializedName: "bypass", + type: { + name: "String" + } + }, + defaultAction: { + serializedName: "defaultAction", + type: { + name: "String" + } + }, + ipRules: { + serializedName: "ipRules", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "IpRule" + } + } + } + }, + virtualNetworkRules: { + serializedName: "virtualNetworkRules", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "VirtualNetworkRule" + } + } + } + } + } + } +}; + export const CognitiveServicesAccount: msRest.CompositeMapper = { serializedName: "CognitiveServicesAccount", type: { @@ -188,6 +280,13 @@ export const CognitiveServicesAccount: msRest.CompositeMapper = { name: "String" } }, + networkAcls: { + serializedName: "properties.networkAcls", + type: { + name: "Composite", + className: "NetworkRuleSet" + } + }, sku: { serializedName: "sku", type: { @@ -625,6 +724,64 @@ export const CheckSkuAvailabilityResultList: msRest.CompositeMapper = { } }; +export const CheckDomainAvailabilityParameter: msRest.CompositeMapper = { + serializedName: "CheckDomainAvailabilityParameter", + type: { + name: "Composite", + className: "CheckDomainAvailabilityParameter", + modelProperties: { + subdomainName: { + required: true, + serializedName: "subdomainName", + type: { + name: "String" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckDomainAvailabilityResult: msRest.CompositeMapper = { + serializedName: "CheckDomainAvailabilityResult", + type: { + name: "Composite", + className: "CheckDomainAvailabilityResult", + modelProperties: { + isSubdomainAvailable: { + serializedName: "isSubdomainAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + }, + subdomainName: { + serializedName: "subdomainName", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + export const ResourceSkuRestrictionInfo: msRest.CompositeMapper = { serializedName: "ResourceSkuRestrictionInfo", type: {