diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md index b3f212752eae..625e28ba5936 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 6.1.0 (2020-03-25) + +**Features** + + - Model CognitiveServicesAccount has a new parameter identity + - Model CognitiveServicesAccountProperties has a new parameter user_owned_storage + - Model CognitiveServicesAccountProperties has a new parameter encryption + ## 6.0.0 (2020-02-07) **Features** diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md index 4a6870b3f3f6..81f5fb518059 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md @@ -2,7 +2,7 @@ This is the Microsoft Azure Cognitive Services Management Client Library. This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. -For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/sdk) +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) # Usage 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 944e33629f5f..9a312db121e2 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 @@ -327,6 +327,10 @@ class CognitiveServicesAccountProperties(Model): :vartype endpoint: str :ivar internal_id: The internal identifier. :vartype internal_id: str + :ivar capabilities: Gets the capabilities of the cognitive services + account. Each item indicates a specific feature is supported by this + account. The value is read only and for reference only. + :vartype capabilities: list[str] :param custom_sub_domain_name: Optional subdomain name used for token-based authentication. :type custom_sub_domain_name: str @@ -347,12 +351,14 @@ class CognitiveServicesAccountProperties(Model): 'provisioning_state': {'readonly': True}, 'endpoint': {'readonly': True}, 'internal_id': {'readonly': True}, + 'capabilities': {'readonly': True}, } _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'endpoint': {'key': 'endpoint', 'type': 'str'}, 'internal_id': {'key': 'internalId', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[str]'}, 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, 'encryption': {'key': 'encryption', 'type': 'Encryption'}, @@ -365,6 +371,7 @@ def __init__(self, **kwargs): self.provisioning_state = None self.endpoint = None self.internal_id = None + self.capabilities = None self.custom_sub_domain_name = kwargs.get('custom_sub_domain_name', None) self.network_acls = kwargs.get('network_acls', None) self.encryption = kwargs.get('encryption', 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 0af98fb8e0dd..d33de394f216 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 @@ -327,6 +327,10 @@ class CognitiveServicesAccountProperties(Model): :vartype endpoint: str :ivar internal_id: The internal identifier. :vartype internal_id: str + :ivar capabilities: Gets the capabilities of the cognitive services + account. Each item indicates a specific feature is supported by this + account. The value is read only and for reference only. + :vartype capabilities: list[str] :param custom_sub_domain_name: Optional subdomain name used for token-based authentication. :type custom_sub_domain_name: str @@ -347,12 +351,14 @@ class CognitiveServicesAccountProperties(Model): 'provisioning_state': {'readonly': True}, 'endpoint': {'readonly': True}, 'internal_id': {'readonly': True}, + 'capabilities': {'readonly': True}, } _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'endpoint': {'key': 'endpoint', 'type': 'str'}, 'internal_id': {'key': 'internalId', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[str]'}, 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, 'encryption': {'key': 'encryption', 'type': 'Encryption'}, @@ -365,6 +371,7 @@ def __init__(self, *, custom_sub_domain_name: str=None, network_acls=None, encry self.provisioning_state = None self.endpoint = None self.internal_id = None + self.capabilities = None self.custom_sub_domain_name = custom_sub_domain_name self.network_acls = network_acls self.encryption = encryption diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/version.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/version.py index 37725706ef72..3f2dd5fa577c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/version.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "6.0.0" +VERSION = "6.1.0" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py index 6e5b2b6c68be..def498175553 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tests/recordings/test_cli_mgmt_cognitiveservices.test_cognitiveservices.yaml b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tests/recordings/test_cli_mgmt_cognitiveservices.test_cognitiveservices.yaml new file mode 100644 index 000000000000..5db6441e4416 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tests/recordings/test_cli_mgmt_cognitiveservices.test_cognitiveservices.yaml @@ -0,0 +1,417 @@ +interactions: +- request: + body: '{"kind": "CognitiveServices", "location": "West US", "sku": {"name": "S0"}, + "identity": {"type": "SystemAssigned"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '115' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount?api-version=2017-04-18 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount","name":"myAccount","type":"Microsoft.CognitiveServices/accounts","etag":"\"4400f53c-0000-0700-0000-5e960a9c0000\"","location":"West + US","sku":{"name":"S0"},"kind":"CognitiveServices","properties":{"endpoint":"https://westus.api.cognitive.microsoft.com/","internalId":"c3683228902b4a068e3cc4426864ee85","dateCreated":"2020-04-14T19:10:20.4031232Z","apiProperties":{},"callRateLimit":{"rules":[{"key":"token","renewalPeriod":1,"count":100,"matchPatterns":[{"path":"sts/v1.0/*","method":"*"}]},{"key":"face","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"face/v1.0/*","method":"*"}]},{"key":"vision.recognizeText","renewalPeriod":1,"count":10,"matchPatterns":[{"path":"vision/recognizeText","method":"POST"},{"path":"vision/textOperations/*","method":"GET"},{"path":"vision/read/*","method":"*"}]},{"key":"vision","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"vision/*","method":"*"}]},{"key":"contentModerator.list","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"contentmoderator/lists/*","method":"*"}]},{"key":"contentModerator.moderate","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"contentmoderator/moderate/*","method":"*"}]},{"key":"contentModerator.review","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"contentmoderator/review/*","method":"*"}]},{"key":"luis.endpoint","renewalPeriod":1,"count":50,"matchPatterns":[{"path":"luis/v2.0/apps/*","method":"*"}]},{"key":"textAnalytics","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"text/analytics/*","method":"*"}]},{"key":"bingVisualSearch","renewalPeriod":1,"count":30,"matchPatterns":[{"path":"bing/v7.0/images/visualsearch/*","method":"*"}]},{"key":"bingSearch","renewalPeriod":1,"count":250,"matchPatterns":[{"path":"bing/*","method":"*"}]},{"key":"bingCustomSearch","renewalPeriod":1,"count":150,"matchPatterns":[{"path":"bingcustomsearch/*","method":"*"}]},{"key":"speech.synthesize","renewalPeriod":1,"count":200,"matchPatterns":[{"path":"speech/synthesize","method":"*"}]},{"key":"speech.customvoicesynthesize","renewalPeriod":1,"count":200,"matchPatterns":[{"path":"speech/customvoicesynthesize","method":"*"}]},{"key":"speech.neuralvoicesynthesize","renewalPeriod":1,"count":200,"matchPatterns":[{"path":"speech/neuralvoicesynthesize","method":"*"}]},{"key":"customvision.prediction","renewalPeriod":1,"count":10,"matchPatterns":[{"path":"customvision/v3.0/prediction/*","method":"*"}]},{"key":"customvision.training","renewalPeriod":1,"count":10,"matchPatterns":[{"path":"customvision/v3.0/training/*","method":"*"}]},{"key":"default","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"*","method":"*"}]}]},"provisioningState":"Succeeded"},"identity":{"principalId":"e8c4e541-e4ed-4d27-9164-fa239dd27890","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","type":"SystemAssigned"}}' + headers: + cache-control: + - no-cache + content-length: + - '2993' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:20 GMT + etag: + - '"4400f53c-0000-0700-0000-5e960a9c0000"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount/usages?api-version=2017-04-18 + response: + body: + string: '{"value":[]}' + headers: + cache-control: + - no-cache + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:20 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount/skus?api-version=2017-04-18 + response: + body: + string: '{"value":[{"resourceType":"Microsoft.CognitiveServices/accounts","sku":{"name":"S0","tier":"Standard"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '105' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:21 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount?api-version=2017-04-18 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount","name":"myAccount","type":"Microsoft.CognitiveServices/accounts","etag":"\"4400f53c-0000-0700-0000-5e960a9c0000\"","location":"West + US","sku":{"name":"S0"},"kind":"CognitiveServices","properties":{"endpoint":"https://westus.api.cognitive.microsoft.com/","internalId":"c3683228902b4a068e3cc4426864ee85","dateCreated":"2020-04-14T19:10:20.4031232Z","apiProperties":{},"callRateLimit":{"rules":[{"key":"token","renewalPeriod":1,"count":100,"matchPatterns":[{"path":"sts/v1.0/*","method":"*"}]},{"key":"face","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"face/v1.0/*","method":"*"}]},{"key":"vision.recognizeText","renewalPeriod":1,"count":10,"matchPatterns":[{"path":"vision/recognizeText","method":"POST"},{"path":"vision/textOperations/*","method":"GET"},{"path":"vision/read/*","method":"*"}]},{"key":"vision","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"vision/*","method":"*"}]},{"key":"contentModerator.list","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"contentmoderator/lists/*","method":"*"}]},{"key":"contentModerator.moderate","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"contentmoderator/moderate/*","method":"*"}]},{"key":"contentModerator.review","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"contentmoderator/review/*","method":"*"}]},{"key":"luis.endpoint","renewalPeriod":1,"count":50,"matchPatterns":[{"path":"luis/v2.0/apps/*","method":"*"}]},{"key":"textAnalytics","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"text/analytics/*","method":"*"}]},{"key":"bingVisualSearch","renewalPeriod":1,"count":30,"matchPatterns":[{"path":"bing/v7.0/images/visualsearch/*","method":"*"}]},{"key":"bingSearch","renewalPeriod":1,"count":250,"matchPatterns":[{"path":"bing/*","method":"*"}]},{"key":"bingCustomSearch","renewalPeriod":1,"count":150,"matchPatterns":[{"path":"bingcustomsearch/*","method":"*"}]},{"key":"speech.synthesize","renewalPeriod":1,"count":200,"matchPatterns":[{"path":"speech/synthesize","method":"*"}]},{"key":"speech.customvoicesynthesize","renewalPeriod":1,"count":200,"matchPatterns":[{"path":"speech/customvoicesynthesize","method":"*"}]},{"key":"speech.neuralvoicesynthesize","renewalPeriod":1,"count":200,"matchPatterns":[{"path":"speech/neuralvoicesynthesize","method":"*"}]},{"key":"customvision.prediction","renewalPeriod":1,"count":10,"matchPatterns":[{"path":"customvision/v3.0/prediction/*","method":"*"}]},{"key":"customvision.training","renewalPeriod":1,"count":10,"matchPatterns":[{"path":"customvision/v3.0/training/*","method":"*"}]},{"key":"default","renewalPeriod":1,"count":20,"matchPatterns":[{"path":"*","method":"*"}]}]},"provisioningState":"Succeeded"},"identity":{"principalId":"e8c4e541-e4ed-4d27-9164-fa239dd27890","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","type":"SystemAssigned"}}' + headers: + cache-control: + - no-cache + content-length: + - '2993' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:21 GMT + etag: + - '"4400f53c-0000-0700-0000-5e960a9c0000"' + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"keyName": "Key2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '19' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount/regenerateKey?api-version=2017-04-18 + response: + body: + string: '{"key1":"bf56bc66d99448d3ac28d820ddbf6e9d","key2":"63bcf8609ebb40b48090f34d27a1118f"}' + headers: + cache-control: + - no-cache + content-length: + - '85' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:22 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount/listKeys?api-version=2017-04-18 + response: + body: + string: '{"key1":"bf56bc66d99448d3ac28d820ddbf6e9d","key2":"63bcf8609ebb40b48090f34d27a1118f"}' + headers: + cache-control: + - no-cache + content-length: + - '85' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:24 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"skus": ["S0"], "kind": "Face", "type": "Microsoft.CognitiveServices/accounts"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '80' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/eastus/checkSkuAvailability?api-version=2017-04-18 + response: + body: + string: '{"value":[{"kind":"Face","type":"Microsoft.CognitiveServices/accounts","skuName":"S0","skuAvailable":true,"reason":null,"message":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '137' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 14 Apr 2020 19:10:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-cognitiveservices/6.1.0 Azure-SDK-For-Python + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_cognitiveservices_test_cognitiveservices680f1670/providers/Microsoft.CognitiveServices/accounts/myAccount?api-version=2017-04-18 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Tue, 14 Apr 2020 19:10:27 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tests/test_cli_mgmt_cognitiveservices.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tests/test_cli_mgmt_cognitiveservices.py new file mode 100644 index 000000000000..935036c4d0ba --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tests/test_cli_mgmt_cognitiveservices.py @@ -0,0 +1,130 @@ +# 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. +#-------------------------------------------------------------------------- + + +# TEST SCENARIO COVERAGE +# ---------------------- +# Methods Total : 14 +# Methods Covered : 14 +# Examples Total : 15 +# Examples Tested : 13 +# Coverage % : 87 +# ---------------------- + +import unittest + +import azure.mgmt.cognitiveservices +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer + +AZURE_LOCATION = 'eastus' + +class MgmtCognitiveServicesTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtCognitiveServicesTest, self).setUp() + self.mgmt_client = self.create_mgmt_client( + azure.mgmt.cognitiveservices.CognitiveServicesManagementClient + ) + + @ResourceGroupPreparer(location=AZURE_LOCATION) + def test_cognitiveservices(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + RESOURCE_GROUP = resource_group.name + ACCOUNT_NAME = "myAccount" + LOCATION = "myLocation" + + # /Accounts/put/Create Account Min[put] + BODY = { + "location": "West US", + "kind": "CognitiveServices", + "sku": { + "name": "S0" + }, + "identity": { + "type": "SystemAssigned" + } + } + result = self.mgmt_client.accounts.create(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, account=BODY) + + # /Accounts/put/Create Account[put] + BODY = { + "location": "West US", + "kind": "Emotion", + "sku": { + "name": "S0" + }, + "properties": { + "encryption": { + "key_vault_properties": { + "key_name": "KeyName", + "key_version": "891CF236-D241-4738-9462-D506AF493DFA", + "key_vault_uri": "https://pltfrmscrts-use-pc-dev.vault.azure.net/" + }, + "key_source": "Microsoft.KeyVault" + }, + "user_owned_storage": [ + { + "resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Storage/storageAccountsfelixwatest" + } + ] + }, + "identity": { + "type": "SystemAssigned" + } + } + # result = self.mgmt_client.accounts.create(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, account=BODY) + + # /Accounts/get/Get Usages[get] + result = self.mgmt_client.accounts.get_usages(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME) + + # /Accounts/get/List SKUs[get] + result = self.mgmt_client.accounts.list_skus(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME) + + # /Accounts/get/Get Account[get] + result = self.mgmt_client.accounts.get_properties(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME) + + # /Accounts/get/List Accounts by Resource Group[get] + result = self.mgmt_client.accounts.list_by_resource_group(resource_group_name=RESOURCE_GROUP) + + # /Accounts/get/List Accounts by Subscription[get] + result = self.mgmt_client.accounts.list() + + # /ResourceSkus/get/Regenerate Keys[get] + result = self.mgmt_client.resource_skus.list() + + # /Operations/get/Get Operations[get] + result = self.mgmt_client.operations.list() + + # /Accounts/post/Regenerate Keys[post] + result = self.mgmt_client.accounts.regenerate_key(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, key_name="Key2") + + # /Accounts/post/List Keys[post] + result = self.mgmt_client.accounts.list_keys(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME) + + # /Accounts/patch/Update Account[patch] + BODY = { + "sku": { + "name": "S2" + } + } + # result = self.mgmt_client.accounts.update(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME, account=BODY) + + # //post/Check SKU Availability[post] + SKUS = [ + "S0" + ] + result = self.mgmt_client.check_sku_availability(location="eastus", skus=SKUS, kind="Face", type="Microsoft.CognitiveServices/accounts") + + # /Accounts/delete/Delete Account[delete] + result = self.mgmt_client.accounts.delete(resource_group_name=RESOURCE_GROUP, account_name=ACCOUNT_NAME) + + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main()