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..dab30ce20fdb 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. */ @@ -558,6 +616,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' diff --git a/sdk/cognitiveservices/arm-cognitiveservices/src/models/mappers.ts b/sdk/cognitiveservices/arm-cognitiveservices/src/models/mappers.ts index 2dd60c875822..d1b794174cd1 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: {