diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py index 2ca978152523..0b5e7f462ac3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py @@ -17,7 +17,6 @@ from .operations import AccountsOperations from .operations import ResourceSkusOperations from .operations import Operations -from .operations import CheckSkuAvailabilityOperations from . import models @@ -33,8 +32,6 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :vartype resource_skus: azure.mgmt.cognitiveservices.operations.ResourceSkusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.cognitiveservices.operations.Operations - :ivar check_sku_availability: CheckSkuAvailability operations - :vartype check_sku_availability: azure.mgmt.cognitiveservices.operations.CheckSkuAvailabilityOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -61,5 +58,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) - self.check_sku_availability = CheckSkuAvailabilityOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py index 96965c85b5f0..049d6d547307 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py @@ -16,10 +16,10 @@ from ._models_py3 import CheckSkuAvailabilityResult from ._models_py3 import CheckSkuAvailabilityResultList from ._models_py3 import CognitiveServicesAccount - from ._models_py3 import CognitiveServicesAccountCreateParameters + from ._models_py3 import CognitiveServicesAccountApiProperties from ._models_py3 import CognitiveServicesAccountEnumerateSkusResult from ._models_py3 import CognitiveServicesAccountKeys - from ._models_py3 import CognitiveServicesAccountUpdateParameters + from ._models_py3 import CognitiveServicesAccountProperties from ._models_py3 import CognitiveServicesResourceAndSku from ._models_py3 import Error, ErrorException from ._models_py3 import ErrorBody @@ -43,10 +43,10 @@ from ._models import CheckSkuAvailabilityResult from ._models import CheckSkuAvailabilityResultList from ._models import CognitiveServicesAccount - from ._models import CognitiveServicesAccountCreateParameters + from ._models import CognitiveServicesAccountApiProperties from ._models import CognitiveServicesAccountEnumerateSkusResult from ._models import CognitiveServicesAccountKeys - from ._models import CognitiveServicesAccountUpdateParameters + from ._models import CognitiveServicesAccountProperties from ._models import CognitiveServicesResourceAndSku from ._models import Error, ErrorException from ._models import ErrorBody @@ -69,7 +69,6 @@ from ._cognitive_services_management_client_enums import ( SkuTier, ProvisioningState, - NetworkRuleBypassOptions, NetworkRuleAction, KeyName, UnitType, @@ -85,10 +84,10 @@ 'CheckSkuAvailabilityResult', 'CheckSkuAvailabilityResultList', 'CognitiveServicesAccount', - 'CognitiveServicesAccountCreateParameters', + 'CognitiveServicesAccountApiProperties', 'CognitiveServicesAccountEnumerateSkusResult', 'CognitiveServicesAccountKeys', - 'CognitiveServicesAccountUpdateParameters', + 'CognitiveServicesAccountProperties', 'CognitiveServicesResourceAndSku', 'Error', 'ErrorException', 'ErrorBody', @@ -110,7 +109,6 @@ 'OperationEntityPaged', 'SkuTier', 'ProvisioningState', - 'NetworkRuleBypassOptions', 'NetworkRuleAction', 'KeyName', 'UnitType', diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py index d2098d0d0cbf..60f105226636 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py @@ -29,12 +29,6 @@ class ProvisioningState(str, Enum): failed = "Failed" -class NetworkRuleBypassOptions(str, Enum): - - azure_services = "AzureServices" - none = "None" - - class NetworkRuleAction(str, Enum): allow = "Allow" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py index 02643c552cc3..b26c82e51b39 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py @@ -169,31 +169,19 @@ class CognitiveServicesAccount(Model): Variables are only populated by the server, and will be ignored when sending a request. - :param etag: Entity Tag - :type etag: str + :ivar etag: Entity Tag + :vartype etag: str :ivar id: The id of the created account :vartype id: str - :param kind: Type of cognitive service account. + :param kind: The Kind of the resource. :type kind: str :param location: The location of the resource :type location: str :ivar name: The name of the created account :vartype name: str - :ivar provisioning_state: Gets the status of the cognitive services - account at the time the operation was called. Possible values include: - 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.cognitiveservices.models.ProvisioningState - :param endpoint: Endpoint of the created account. - :type endpoint: str - :param internal_id: The internal identifier. - :type internal_id: str - :param custom_sub_domain_name: Optional subdomain name used for - token-based authentication. - :type custom_sub_domain_name: str - :param network_acls: A collection of rules governing the accessibility - from specific network locations. - :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet + :param properties: Properties of Cognitive Services account. + :type properties: + ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountProperties :param sku: The SKU of Cognitive Services account. :type sku: ~azure.mgmt.cognitiveservices.models.Sku :param tags: Gets or sets a list of key value pairs that describe the @@ -207,9 +195,9 @@ class CognitiveServicesAccount(Model): """ _validation = { + 'etag': {'readonly': True}, 'id': {'readonly': True}, 'name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, 'type': {'readonly': True}, } @@ -219,11 +207,7 @@ class CognitiveServicesAccount(Model): 'kind': {'key': 'kind', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'internal_id': {'key': 'properties.internalId', 'type': 'str'}, - 'custom_sub_domain_name': {'key': 'properties.customSubDomainName', 'type': 'str'}, - 'network_acls': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, + 'properties': {'key': 'properties', 'type': 'CognitiveServicesAccountProperties'}, 'sku': {'key': 'sku', 'type': 'Sku'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'type': {'key': 'type', 'type': 'str'}, @@ -231,69 +215,52 @@ class CognitiveServicesAccount(Model): def __init__(self, **kwargs): super(CognitiveServicesAccount, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) + self.etag = None self.id = None self.kind = kwargs.get('kind', None) self.location = kwargs.get('location', None) self.name = None - self.provisioning_state = None - self.endpoint = kwargs.get('endpoint', None) - self.internal_id = kwargs.get('internal_id', None) - self.custom_sub_domain_name = kwargs.get('custom_sub_domain_name', None) - self.network_acls = kwargs.get('network_acls', None) + self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) self.type = None -class CognitiveServicesAccountCreateParameters(Model): - """The parameters to provide for the account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param kind: Required. Required. Gets or sets the Kind of the resource. - :type kind: str - :param location: Required. 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. - :type location: str - :param 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. - :type tags: dict[str, str] - :param properties: Required. Must exist in the request. Must be an empty - object. Must not be null. - :type properties: object +class CognitiveServicesAccountApiProperties(Model): + """The api properties for special APIs. + + :param qna_runtime_endpoint: (QnAMaker Only) The runtime endpoint of + QnAMaker. + :type qna_runtime_endpoint: str + :param statistics_enabled: (Bing Search Only) The flag to enable + statistics of Bing Search. + :type statistics_enabled: bool + :param event_hub_connection_string: (Personalization Only) The flag to + enable statistics of Bing Search. + :type event_hub_connection_string: str + :param storage_account_connection_string: (Personalization Only) The + storage account connection string. + :type storage_account_connection_string: str """ _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - 'properties': {'required': True}, + 'event_hub_connection_string': {'max_length': 1000, 'pattern': r'^( *)Endpoint=sb://(.*);( *)SharedAccessKeyName=(.*);( *)SharedAccessKey=(.*)$'}, + 'storage_account_connection_string': {'max_length': 1000, 'pattern': r'^(( *)DefaultEndpointsProtocol=(http|https)( *);( *))?AccountName=(.*)AccountKey=(.*)EndpointSuffix=(.*)$'}, } _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'qna_runtime_endpoint': {'key': 'qnaRuntimeEndpoint', 'type': 'str'}, + 'statistics_enabled': {'key': 'statisticsEnabled', 'type': 'bool'}, + 'event_hub_connection_string': {'key': 'eventHubConnectionString', 'type': 'str'}, + 'storage_account_connection_string': {'key': 'storageAccountConnectionString', 'type': 'str'}, } def __init__(self, **kwargs): - super(CognitiveServicesAccountCreateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + super(CognitiveServicesAccountApiProperties, self).__init__(**kwargs) + self.qna_runtime_endpoint = kwargs.get('qna_runtime_endpoint', None) + self.statistics_enabled = kwargs.get('statistics_enabled', None) + self.event_hub_connection_string = kwargs.get('event_hub_connection_string', None) + self.storage_account_connection_string = kwargs.get('storage_account_connection_string', None) class CognitiveServicesAccountEnumerateSkusResult(Model): @@ -341,33 +308,55 @@ def __init__(self, **kwargs): self.key2 = kwargs.get('key2', None) -class CognitiveServicesAccountUpdateParameters(Model): - """The parameters to provide for the account. +class CognitiveServicesAccountProperties(Model): + """Properties of Cognitive Services account. - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param 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. - :type tags: dict[str, str] - :param properties: Additional properties for Account. Only provided fields - will be updated. - :type properties: object + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: Gets the status of the cognitive services + account at the time the operation was called. Possible values include: + 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar endpoint: Endpoint of the created account. + :vartype endpoint: str + :ivar internal_id: The internal identifier. + :vartype internal_id: str + :param custom_sub_domain_name: Optional subdomain name used for + token-based authentication. + :type custom_sub_domain_name: str + :param network_acls: A collection of rules governing the accessibility + from specific network locations. + :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet + :param api_properties: The api properties for special APIs. + :type api_properties: + ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountApiProperties """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'endpoint': {'readonly': True}, + 'internal_id': {'readonly': True}, + } + _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'internal_id': {'key': 'internalId', 'type': 'str'}, + 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'api_properties': {'key': 'apiProperties', 'type': 'CognitiveServicesAccountApiProperties'}, } def __init__(self, **kwargs): - super(CognitiveServicesAccountUpdateParameters, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + super(CognitiveServicesAccountProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.endpoint = None + self.internal_id = None + self.custom_sub_domain_name = kwargs.get('custom_sub_domain_name', None) + self.network_acls = kwargs.get('network_acls', None) + self.api_properties = kwargs.get('api_properties', None) class CognitiveServicesResourceAndSku(Model): @@ -500,11 +489,6 @@ def __init__(self, **kwargs): class NetworkRuleSet(Model): """A set of rules governing the network accessibility. - :param bypass: 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' - :type bypass: str or - ~azure.mgmt.cognitiveservices.models.NetworkRuleBypassOptions :param default_action: 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' @@ -518,7 +502,6 @@ class NetworkRuleSet(Model): """ _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, 'default_action': {'key': 'defaultAction', 'type': 'str'}, 'ip_rules': {'key': 'ipRules', 'type': '[IpRule]'}, 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, @@ -526,7 +509,6 @@ class NetworkRuleSet(Model): def __init__(self, **kwargs): super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) self.ip_rules = kwargs.get('ip_rules', None) self.virtual_network_rules = kwargs.get('virtual_network_rules', None) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py index d0c111651f88..e7af96f33dc3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py @@ -169,31 +169,19 @@ class CognitiveServicesAccount(Model): Variables are only populated by the server, and will be ignored when sending a request. - :param etag: Entity Tag - :type etag: str + :ivar etag: Entity Tag + :vartype etag: str :ivar id: The id of the created account :vartype id: str - :param kind: Type of cognitive service account. + :param kind: The Kind of the resource. :type kind: str :param location: The location of the resource :type location: str :ivar name: The name of the created account :vartype name: str - :ivar provisioning_state: Gets the status of the cognitive services - account at the time the operation was called. Possible values include: - 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed' - :vartype provisioning_state: str or - ~azure.mgmt.cognitiveservices.models.ProvisioningState - :param endpoint: Endpoint of the created account. - :type endpoint: str - :param internal_id: The internal identifier. - :type internal_id: str - :param custom_sub_domain_name: Optional subdomain name used for - token-based authentication. - :type custom_sub_domain_name: str - :param network_acls: A collection of rules governing the accessibility - from specific network locations. - :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet + :param properties: Properties of Cognitive Services account. + :type properties: + ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountProperties :param sku: The SKU of Cognitive Services account. :type sku: ~azure.mgmt.cognitiveservices.models.Sku :param tags: Gets or sets a list of key value pairs that describe the @@ -207,9 +195,9 @@ class CognitiveServicesAccount(Model): """ _validation = { + 'etag': {'readonly': True}, 'id': {'readonly': True}, 'name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, 'type': {'readonly': True}, } @@ -219,81 +207,60 @@ class CognitiveServicesAccount(Model): 'kind': {'key': 'kind', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'endpoint': {'key': 'properties.endpoint', 'type': 'str'}, - 'internal_id': {'key': 'properties.internalId', 'type': 'str'}, - 'custom_sub_domain_name': {'key': 'properties.customSubDomainName', 'type': 'str'}, - 'network_acls': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, + 'properties': {'key': 'properties', 'type': 'CognitiveServicesAccountProperties'}, 'sku': {'key': 'sku', 'type': 'Sku'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, etag: str=None, kind: str=None, location: str=None, endpoint: str=None, internal_id: str=None, custom_sub_domain_name: str=None, network_acls=None, sku=None, tags=None, **kwargs) -> None: + def __init__(self, *, kind: str=None, location: str=None, properties=None, sku=None, tags=None, **kwargs) -> None: super(CognitiveServicesAccount, self).__init__(**kwargs) - self.etag = etag + self.etag = None self.id = None self.kind = kind self.location = location self.name = None - self.provisioning_state = None - self.endpoint = endpoint - self.internal_id = internal_id - self.custom_sub_domain_name = custom_sub_domain_name - self.network_acls = network_acls + self.properties = properties self.sku = sku self.tags = tags self.type = None -class CognitiveServicesAccountCreateParameters(Model): - """The parameters to provide for the account. - - All required parameters must be populated in order to send to Azure. - - :param sku: Required. Required. Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param kind: Required. Required. Gets or sets the Kind of the resource. - :type kind: str - :param location: Required. 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. - :type location: str - :param 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. - :type tags: dict[str, str] - :param properties: Required. Must exist in the request. Must be an empty - object. Must not be null. - :type properties: object +class CognitiveServicesAccountApiProperties(Model): + """The api properties for special APIs. + + :param qna_runtime_endpoint: (QnAMaker Only) The runtime endpoint of + QnAMaker. + :type qna_runtime_endpoint: str + :param statistics_enabled: (Bing Search Only) The flag to enable + statistics of Bing Search. + :type statistics_enabled: bool + :param event_hub_connection_string: (Personalization Only) The flag to + enable statistics of Bing Search. + :type event_hub_connection_string: str + :param storage_account_connection_string: (Personalization Only) The + storage account connection string. + :type storage_account_connection_string: str """ _validation = { - 'sku': {'required': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - 'properties': {'required': True}, + 'event_hub_connection_string': {'max_length': 1000, 'pattern': r'^( *)Endpoint=sb://(.*);( *)SharedAccessKeyName=(.*);( *)SharedAccessKey=(.*)$'}, + 'storage_account_connection_string': {'max_length': 1000, 'pattern': r'^(( *)DefaultEndpointsProtocol=(http|https)( *);( *))?AccountName=(.*)AccountKey=(.*)EndpointSuffix=(.*)$'}, } _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'qna_runtime_endpoint': {'key': 'qnaRuntimeEndpoint', 'type': 'str'}, + 'statistics_enabled': {'key': 'statisticsEnabled', 'type': 'bool'}, + 'event_hub_connection_string': {'key': 'eventHubConnectionString', 'type': 'str'}, + 'storage_account_connection_string': {'key': 'storageAccountConnectionString', 'type': 'str'}, } - def __init__(self, *, sku, kind: str, location: str, properties, tags=None, **kwargs) -> None: - super(CognitiveServicesAccountCreateParameters, self).__init__(**kwargs) - self.sku = sku - self.kind = kind - self.location = location - self.tags = tags - self.properties = properties + def __init__(self, *, qna_runtime_endpoint: str=None, statistics_enabled: bool=None, event_hub_connection_string: str=None, storage_account_connection_string: str=None, **kwargs) -> None: + super(CognitiveServicesAccountApiProperties, self).__init__(**kwargs) + self.qna_runtime_endpoint = qna_runtime_endpoint + self.statistics_enabled = statistics_enabled + self.event_hub_connection_string = event_hub_connection_string + self.storage_account_connection_string = storage_account_connection_string class CognitiveServicesAccountEnumerateSkusResult(Model): @@ -341,33 +308,55 @@ def __init__(self, *, key1: str=None, key2: str=None, **kwargs) -> None: self.key2 = key2 -class CognitiveServicesAccountUpdateParameters(Model): - """The parameters to provide for the account. +class CognitiveServicesAccountProperties(Model): + """Properties of Cognitive Services account. - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param 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. - :type tags: dict[str, str] - :param properties: Additional properties for Account. Only provided fields - will be updated. - :type properties: object + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: Gets the status of the cognitive services + account at the time the operation was called. Possible values include: + 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed' + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar endpoint: Endpoint of the created account. + :vartype endpoint: str + :ivar internal_id: The internal identifier. + :vartype internal_id: str + :param custom_sub_domain_name: Optional subdomain name used for + token-based authentication. + :type custom_sub_domain_name: str + :param network_acls: A collection of rules governing the accessibility + from specific network locations. + :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet + :param api_properties: The api properties for special APIs. + :type api_properties: + ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountApiProperties """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'endpoint': {'readonly': True}, + 'internal_id': {'readonly': True}, + } + _attribute_map = { - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'internal_id': {'key': 'internalId', 'type': 'str'}, + 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'api_properties': {'key': 'apiProperties', 'type': 'CognitiveServicesAccountApiProperties'}, } - def __init__(self, *, sku=None, tags=None, properties=None, **kwargs) -> None: - super(CognitiveServicesAccountUpdateParameters, self).__init__(**kwargs) - self.sku = sku - self.tags = tags - self.properties = properties + def __init__(self, *, custom_sub_domain_name: str=None, network_acls=None, api_properties=None, **kwargs) -> None: + super(CognitiveServicesAccountProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.endpoint = None + self.internal_id = None + self.custom_sub_domain_name = custom_sub_domain_name + self.network_acls = network_acls + self.api_properties = api_properties class CognitiveServicesResourceAndSku(Model): @@ -500,11 +489,6 @@ def __init__(self, **kwargs) -> None: class NetworkRuleSet(Model): """A set of rules governing the network accessibility. - :param bypass: 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' - :type bypass: str or - ~azure.mgmt.cognitiveservices.models.NetworkRuleBypassOptions :param default_action: 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' @@ -518,15 +502,13 @@ class NetworkRuleSet(Model): """ _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, 'default_action': {'key': 'defaultAction', 'type': 'str'}, 'ip_rules': {'key': 'ipRules', 'type': '[IpRule]'}, 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, } - def __init__(self, *, bypass=None, default_action=None, ip_rules=None, virtual_network_rules=None, **kwargs) -> None: + def __init__(self, *, default_action=None, ip_rules=None, virtual_network_rules=None, **kwargs) -> None: super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = bypass self.default_action = default_action self.ip_rules = ip_rules self.virtual_network_rules = virtual_network_rules diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py index 751c6929e4df..a8b7e783c13f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py @@ -12,13 +12,11 @@ from ._accounts_operations import AccountsOperations from ._resource_skus_operations import ResourceSkusOperations from ._operations import Operations -from ._check_sku_availability_operations import CheckSkuAvailabilityOperations from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin __all__ = [ 'AccountsOperations', 'ResourceSkusOperations', 'Operations', - 'CheckSkuAvailabilityOperations', 'CognitiveServicesManagementClientOperationsMixin', ] diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py index 36f867bd65aa..b3d4adadaf2e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py @@ -39,7 +39,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, account, custom_headers=None, raw=False, **operation_config): """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. @@ -49,9 +49,9 @@ def create( :type resource_group_name: str :param account_name: The name of Cognitive Services account. :type account_name: str - :param parameters: The parameters to provide for the created account. - :type parameters: - ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountCreateParameters + :param account: The parameters to provide for the created account. + :type account: + ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -88,7 +88,7 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'CognitiveServicesAccountCreateParameters') + body_content = self._serialize.body(account, 'CognitiveServicesAccount') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -111,7 +111,7 @@ def create( create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} def update( - self, resource_group_name, account_name, sku=None, tags=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, account, custom_headers=None, raw=False, **operation_config): """Updates a Cognitive Services account. :param resource_group_name: The name of the resource group within the @@ -119,17 +119,9 @@ def update( :type resource_group_name: str :param account_name: The name of Cognitive Services account. :type account_name: str - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param 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. - :type tags: dict[str, str] - :param properties: Additional properties for Account. Only provided - fields will be updated. - :type properties: object + :param account: The parameters to provide for the created account. + :type account: + ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -141,8 +133,6 @@ def update( :raises: :class:`ErrorException` """ - parameters = models.CognitiveServicesAccountUpdateParameters(sku=sku, tags=tags, properties=properties) - # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -168,7 +158,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'CognitiveServicesAccountUpdateParameters') + body_content = self._serialize.body(account, 'CognitiveServicesAccount') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_check_sku_availability_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_check_sku_availability_operations.py deleted file mode 100644 index b176a5a4babc..000000000000 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_check_sku_availability_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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 uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class CheckSkuAvailabilityOperations(object): - """CheckSkuAvailabilityOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-18. Constant value: "2017-04-18". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2017-04-18" - - self.config = config - - def list( - self, location, skus, kind, type, custom_headers=None, raw=False, **operation_config): - """Check available SKUs. - - :param location: Resource location. - :type location: str - :param skus: The SKU of the resource. - :type skus: list[str] - :param kind: The Kind of the resource. - :type kind: str - :param type: The Type of the resource. - :type type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckSkuAvailabilityResultList or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResultList or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - parameters = models.CheckSkuAvailabilityParameter(skus=skus, kind=kind, type=type) - - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CheckSkuAvailabilityParameter') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckSkuAvailabilityResultList', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability'} diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py index 5b6108a2f85a..fe218a2ed09f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py @@ -17,6 +17,78 @@ class CognitiveServicesManagementClientOperationsMixin(object): + def check_sku_availability( + self, location, skus, kind, type, custom_headers=None, raw=False, **operation_config): + """Check available SKUs. + + :param location: Resource location. + :type location: str + :param skus: The SKU of the resource. + :type skus: list[str] + :param kind: The Kind of the resource. + :type kind: str + :param type: The Type of the resource. + :type type: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckSkuAvailabilityResultList or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResultList or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.CheckSkuAvailabilityParameter(skus=skus, kind=kind, type=type) + + # Construct URL + url = self.check_sku_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckSkuAvailabilityParameter') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckSkuAvailabilityResultList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_sku_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability'} + def check_domain_availability( self, subdomain_name, type, custom_headers=None, raw=False, **operation_config): """Check whether a domain is available.