diff --git a/sdk/azurestack/azure-mgmt-azurestack/CHANGELOG.md b/sdk/azurestack/azure-mgmt-azurestack/CHANGELOG.md index 09ecb6f3887f..d7edcaf53572 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/CHANGELOG.md +++ b/sdk/azurestack/azure-mgmt-azurestack/CHANGELOG.md @@ -1,5 +1,22 @@ # Release History +## 1.0.0 (2021-04-08) + +**Features** + + - Model Registration has a new parameter system_data + - Model Registration has a new parameter kind + - Model TrackedResource has a new parameter system_data + - Model TrackedResource has a new parameter kind + - Model CustomerSubscription has a new parameter system_data + - Model Product has a new parameter system_data + - Added operation RegistrationsOperations.enable_remote_management + - Added operation group LinkedSubscriptionsOperations + +**Breaking changes** + + - Operation ProductsOperations.get_products has a new signature + ## 1.0.0b1 (2020-12-03) This is beta preview version. diff --git a/sdk/azurestack/azure-mgmt-azurestack/MANIFEST.in b/sdk/azurestack/azure-mgmt-azurestack/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/MANIFEST.in +++ b/sdk/azurestack/azure-mgmt-azurestack/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/azurestack/azure-mgmt-azurestack/_meta.json b/sdk/azurestack/azure-mgmt-azurestack/_meta.json new file mode 100644 index 000000000000..231a159efafd --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.0.6369", + "use": "@autorest/python@5.6.2", + "commit": "ea6ceada9e22eb0d455288d339955dfe56521302", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/azurestack/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369", + "readme": "specification/azurestack/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py index 70c5fd03aaaf..f25c3bfa7b04 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_azure_stack_management_client.py @@ -20,9 +20,10 @@ from ._configuration import AzureStackManagementClientConfiguration from .operations import Operations from .operations import CloudManifestFileOperations +from .operations import CustomerSubscriptionsOperations from .operations import ProductsOperations from .operations import RegistrationsOperations -from .operations import CustomerSubscriptionsOperations +from .operations import LinkedSubscriptionsOperations from . import models @@ -33,12 +34,14 @@ class AzureStackManagementClient(object): :vartype operations: azure.mgmt.azurestack.operations.Operations :ivar cloud_manifest_file: CloudManifestFileOperations operations :vartype cloud_manifest_file: azure.mgmt.azurestack.operations.CloudManifestFileOperations + :ivar customer_subscriptions: CustomerSubscriptionsOperations operations + :vartype customer_subscriptions: azure.mgmt.azurestack.operations.CustomerSubscriptionsOperations :ivar products: ProductsOperations operations :vartype products: azure.mgmt.azurestack.operations.ProductsOperations :ivar registrations: RegistrationsOperations operations :vartype registrations: azure.mgmt.azurestack.operations.RegistrationsOperations - :ivar customer_subscriptions: CustomerSubscriptionsOperations operations - :vartype customer_subscriptions: azure.mgmt.azurestack.operations.CustomerSubscriptionsOperations + :ivar linked_subscriptions: LinkedSubscriptionsOperations operations + :vartype linked_subscriptions: azure.mgmt.azurestack.operations.LinkedSubscriptionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -68,11 +71,13 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.cloud_manifest_file = CloudManifestFileOperations( self._client, self._config, self._serialize, self._deserialize) + self.customer_subscriptions = CustomerSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) self.products = ProductsOperations( self._client, self._config, self._serialize, self._deserialize) self.registrations = RegistrationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.customer_subscriptions = CustomerSubscriptionsOperations( + self.linked_subscriptions = LinkedSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize) def close(self): diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py index 3f470350668a..53a1c0957dff 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-06-01" + self.api_version = "2020-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurestack/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json new file mode 100644 index 000000000000..33c346444236 --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_metadata.json @@ -0,0 +1,114 @@ +{ + "chosen_version": "2020-06-01-preview", + "total_api_version_list": ["2020-06-01-preview"], + "client": { + "name": "AzureStackManagementClient", + "filename": "_azure_stack_management_client", + "description": "Azure Stack.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "cloud_manifest_file": "CloudManifestFileOperations", + "customer_subscriptions": "CustomerSubscriptionsOperations", + "products": "ProductsOperations", + "registrations": "RegistrationsOperations", + "linked_subscriptions": "LinkedSubscriptionsOperations" + }, + "operation_mixins": { + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } +} \ No newline at end of file diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py index 515f51c112dd..c47f66669f1b 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/_version.py @@ -6,5 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" - +VERSION = "1.0.0" diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py index ea151ec478c9..91fc40d3bba6 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_azure_stack_management_client.py @@ -18,9 +18,10 @@ from ._configuration import AzureStackManagementClientConfiguration from .operations import Operations from .operations import CloudManifestFileOperations +from .operations import CustomerSubscriptionsOperations from .operations import ProductsOperations from .operations import RegistrationsOperations -from .operations import CustomerSubscriptionsOperations +from .operations import LinkedSubscriptionsOperations from .. import models @@ -31,12 +32,14 @@ class AzureStackManagementClient(object): :vartype operations: azure.mgmt.azurestack.aio.operations.Operations :ivar cloud_manifest_file: CloudManifestFileOperations operations :vartype cloud_manifest_file: azure.mgmt.azurestack.aio.operations.CloudManifestFileOperations + :ivar customer_subscriptions: CustomerSubscriptionsOperations operations + :vartype customer_subscriptions: azure.mgmt.azurestack.aio.operations.CustomerSubscriptionsOperations :ivar products: ProductsOperations operations :vartype products: azure.mgmt.azurestack.aio.operations.ProductsOperations :ivar registrations: RegistrationsOperations operations :vartype registrations: azure.mgmt.azurestack.aio.operations.RegistrationsOperations - :ivar customer_subscriptions: CustomerSubscriptionsOperations operations - :vartype customer_subscriptions: azure.mgmt.azurestack.aio.operations.CustomerSubscriptionsOperations + :ivar linked_subscriptions: LinkedSubscriptionsOperations operations + :vartype linked_subscriptions: azure.mgmt.azurestack.aio.operations.LinkedSubscriptionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -65,11 +68,13 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.cloud_manifest_file = CloudManifestFileOperations( self._client, self._config, self._serialize, self._deserialize) + self.customer_subscriptions = CustomerSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize) self.products = ProductsOperations( self._client, self._config, self._serialize, self._deserialize) self.registrations = RegistrationsOperations( self._client, self._config, self._serialize, self._deserialize) - self.customer_subscriptions = CustomerSubscriptionsOperations( + self.linked_subscriptions = LinkedSubscriptionsOperations( self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py index 98ba4aebf81c..10a75cee4d56 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/_configuration.py @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-06-01" + self.api_version = "2020-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurestack/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/__init__.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/__init__.py index 22ab8459e498..dccefb1018e3 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/__init__.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/__init__.py @@ -8,14 +8,16 @@ from ._operations import Operations from ._cloud_manifest_file_operations import CloudManifestFileOperations +from ._customer_subscriptions_operations import CustomerSubscriptionsOperations from ._products_operations import ProductsOperations from ._registrations_operations import RegistrationsOperations -from ._customer_subscriptions_operations import CustomerSubscriptionsOperations +from ._linked_subscriptions_operations import LinkedSubscriptionsOperations __all__ = [ 'Operations', 'CloudManifestFileOperations', + 'CustomerSubscriptionsOperations', 'ProductsOperations', 'RegistrationsOperations', - 'CustomerSubscriptionsOperations', + 'LinkedSubscriptionsOperations', ] diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py index 3e8dd5027cad..337d3857a018 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_cloud_manifest_file_operations.py @@ -56,7 +56,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -76,7 +76,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) @@ -109,7 +109,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -135,7 +135,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py index 67f335bd1ed3..08c4a31c8caa 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_customer_subscriptions_operations.py @@ -63,7 +63,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -105,7 +105,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -141,7 +141,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -168,7 +168,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) @@ -204,7 +204,8 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -222,6 +223,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -229,7 +231,8 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) @@ -264,7 +267,7 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -296,7 +299,8 @@ async def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py new file mode 100644 index 000000000000..095d00e6062b --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_linked_subscriptions_operations.py @@ -0,0 +1,433 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LinkedSubscriptionsOperations: + """LinkedSubscriptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestack.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group: str, + **kwargs + ) -> AsyncIterable["_models.LinkedSubscriptionsList"]: + """Returns a list of all linked subscriptions under current resource group. + + :param resource_group: Name of the resource group. + :type resource_group: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.LinkedSubscriptionsList"]: + """Returns a list of all linked subscriptions under current subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + + async def get( + self, + resource_group: str, + linked_subscription_name: str, + **kwargs + ) -> "_models.LinkedSubscription": + """Returns the properties of a Linked Subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LinkedSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.azurestack.models.LinkedSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + async def delete( + self, + resource_group: str, + linked_subscription_name: str, + **kwargs + ) -> None: + """Delete the requested Linked Subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + async def create_or_update( + self, + resource_group: str, + linked_subscription_name: str, + resource: "_models.LinkedSubscriptionParameter", + **kwargs + ) -> "_models.LinkedSubscription": + """Create or update a linked subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :param resource: Linked subscription resource parameter. + :type resource: ~azure.mgmt.azurestack.models.LinkedSubscriptionParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LinkedSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.azurestack.models.LinkedSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + async def update( + self, + resource_group: str, + linked_subscription_name: str, + resource: "_models.LinkedSubscriptionParameter", + **kwargs + ) -> "_models.LinkedSubscription": + """Patch a Linked Subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :param resource: Linked subscription resource parameter. + :type resource: ~azure.mgmt.azurestack.models.LinkedSubscriptionParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LinkedSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.azurestack.models.LinkedSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py index b9451c055112..a098bc86b52d 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_operations.py @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -93,8 +93,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py index 8bffb613ca99..027d75cf82d5 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_products_operations.py @@ -63,7 +63,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -105,7 +105,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -141,7 +141,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -168,7 +168,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -204,7 +204,7 @@ async def list_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -231,7 +231,8 @@ async def list_details( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtendedProduct', pipeline_response) @@ -245,6 +246,7 @@ async def get_products( self, resource_group: str, registration_name: str, + product_name: str, device_configuration: Optional["_models.DeviceConfiguration"] = None, **kwargs ) -> "_models.ProductList": @@ -254,6 +256,8 @@ async def get_products( :type resource_group: str :param registration_name: Name of the Azure Stack registration. :type registration_name: str + :param product_name: Name of the product. + :type product_name: str :param device_configuration: Device configuration. :type device_configuration: ~azure.mgmt.azurestack.models.DeviceConfiguration :keyword callable cls: A custom type or function that will be passed the direct response @@ -266,7 +270,7 @@ async def get_products( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -276,6 +280,7 @@ async def get_products( 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), + 'productName': self._serialize.url("product_name", product_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -300,7 +305,7 @@ async def get_products( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductList', pipeline_response) @@ -309,7 +314,7 @@ async def get_products( return cls(pipeline_response, deserialized, {}) return deserialized - get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/_all/GetProducts'} # type: ignore + get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts'} # type: ignore async def get_product( self, @@ -339,7 +344,7 @@ async def get_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -374,7 +379,7 @@ async def get_product( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -383,7 +388,7 @@ async def get_product( return cls(pipeline_response, deserialized, {}) return deserialized - get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/GetProduct'} # type: ignore + get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct'} # type: ignore async def upload_log( self, @@ -413,7 +418,7 @@ async def upload_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -448,7 +453,7 @@ async def upload_log( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductLog', pipeline_response) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py index 7440a358d7cc..2f2131c73c71 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/aio/operations/_registrations_operations.py @@ -60,7 +60,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -101,7 +101,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -134,7 +134,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -160,7 +160,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -193,7 +193,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -219,7 +219,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -252,7 +252,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -283,7 +283,8 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Registration', pipeline_response) @@ -322,7 +323,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -353,7 +354,7 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -386,7 +387,7 @@ async def get_activation_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -412,7 +413,8 @@ async def get_activation_key( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivationKeyResult', pipeline_response) @@ -421,3 +423,57 @@ async def get_activation_key( return deserialized get_activation_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey'} # type: ignore + + async def enable_remote_management( + self, + resource_group: str, + registration_name: str, + **kwargs + ) -> None: + """Enables remote management for device under the Azure Stack registration. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param registration_name: Name of the Azure Stack registration. + :type registration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.enable_remote_management.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + enable_remote_management.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement'} # type: ignore diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py index f7da4c3d4611..5a9d84253069 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/__init__.py @@ -22,6 +22,9 @@ from ._models_py3 import ExtendedProduct from ._models_py3 import ExtendedProductProperties from ._models_py3 import IconUris + from ._models_py3 import LinkedSubscription + from ._models_py3 import LinkedSubscriptionParameter + from ._models_py3 import LinkedSubscriptionsList from ._models_py3 import MarketplaceProductLogUpdate from ._models_py3 import Operation from ._models_py3 import OperationList @@ -35,6 +38,7 @@ from ._models_py3 import RegistrationList from ._models_py3 import RegistrationParameter from ._models_py3 import Resource + from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import VirtualMachineExtensionProductProperties from ._models_py3 import VirtualMachineProductProperties @@ -54,6 +58,9 @@ from ._models import ExtendedProduct # type: ignore from ._models import ExtendedProductProperties # type: ignore from ._models import IconUris # type: ignore + from ._models import LinkedSubscription # type: ignore + from ._models import LinkedSubscriptionParameter # type: ignore + from ._models import LinkedSubscriptionsList # type: ignore from ._models import MarketplaceProductLogUpdate # type: ignore from ._models import Operation # type: ignore from ._models import OperationList # type: ignore @@ -67,6 +74,7 @@ from ._models import RegistrationList # type: ignore from ._models import RegistrationParameter # type: ignore from ._models import Resource # type: ignore + from ._models import SystemData # type: ignore from ._models import TrackedResource # type: ignore from ._models import VirtualMachineExtensionProductProperties # type: ignore from ._models import VirtualMachineProductProperties # type: ignore @@ -75,6 +83,7 @@ Category, CompatibilityIssue, ComputeRole, + CreatedByType, Location, OperatingSystem, ProvisioningState, @@ -96,6 +105,9 @@ 'ExtendedProduct', 'ExtendedProductProperties', 'IconUris', + 'LinkedSubscription', + 'LinkedSubscriptionParameter', + 'LinkedSubscriptionsList', 'MarketplaceProductLogUpdate', 'Operation', 'OperationList', @@ -109,12 +121,14 @@ 'RegistrationList', 'RegistrationParameter', 'Resource', + 'SystemData', 'TrackedResource', 'VirtualMachineExtensionProductProperties', 'VirtualMachineProductProperties', 'Category', 'CompatibilityIssue', 'ComputeRole', + 'CreatedByType', 'Location', 'OperatingSystem', 'ProvisioningState', diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py index 5e9251c966e9..44c8218635a0 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_azure_stack_management_client_enums.py @@ -56,6 +56,15 @@ class ComputeRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IAA_S = "IaaS" PAA_S = "PaaS" +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + class Location(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Location of the resource. """ diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py index 614ddb13a3cf..827ca6dadb46 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models.py @@ -205,6 +205,8 @@ class CustomerSubscription(Resource): :vartype type: str :param etag: The entity tag used for optimistic concurrency when modifying the resource. :type etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -213,6 +215,7 @@ class CustomerSubscription(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -220,6 +223,7 @@ class CustomerSubscription(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, } @@ -228,6 +232,7 @@ def __init__( **kwargs ): super(CustomerSubscription, self).__init__(**kwargs) + self.system_data = None self.tenant_id = kwargs.get('tenant_id', None) @@ -685,6 +690,214 @@ def __init__( self.hero = kwargs.get('hero', None) +class TrackedResource(msrest.serialization.Model): + """Base resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ID of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of Resource. + :vartype type: str + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData + :param location: Required. Location of the resource. Possible values include: "global". + :type location: str or ~azure.mgmt.azurestack.models.Location + :param tags: A set of tags. Custom tags for the resource. + :type tags: dict[str, str] + :param etag: The entity tag used for optimistic concurrency when modifying the resource. + :type etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kind = None + self.system_data = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.etag = kwargs.get('etag', None) + + +class LinkedSubscription(TrackedResource): + """Linked Subscription information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ID of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of Resource. + :vartype type: str + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData + :param location: Required. Location of the resource. Possible values include: "global". + :type location: str or ~azure.mgmt.azurestack.models.Location + :param tags: A set of tags. Custom tags for the resource. + :type tags: dict[str, str] + :param etag: The entity tag used for optimistic concurrency when modifying the resource. + :type etag: str + :param linked_subscription_id: The identifier associated with the device subscription. + :type linked_subscription_id: str + :param registration_resource_id: The identifier associated with the device registration. + :type registration_resource_id: str + :ivar device_id: The identifier of the Azure Stack device for remote management. + :vartype device_id: str + :ivar device_object_id: The object identifier associated with the Azure Stack device connecting + to Azure. + :vartype device_object_id: str + :ivar device_link_state: The connection state of the Azure Stack device. + :vartype device_link_state: str + :ivar last_connected_time: The last remote management connection time for the Azure Stack + device connected to the linked subscription resource. + :vartype last_connected_time: str + :ivar device_connection_status: The status of the remote management connection of the Azure + Stack device. + :vartype device_connection_status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'device_id': {'readonly': True}, + 'device_object_id': {'readonly': True}, + 'device_link_state': {'readonly': True}, + 'last_connected_time': {'readonly': True}, + 'device_connection_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'linked_subscription_id': {'key': 'properties.linkedSubscriptionId', 'type': 'str'}, + 'registration_resource_id': {'key': 'properties.registrationResourceId', 'type': 'str'}, + 'device_id': {'key': 'properties.deviceId', 'type': 'str'}, + 'device_object_id': {'key': 'properties.deviceObjectId', 'type': 'str'}, + 'device_link_state': {'key': 'properties.deviceLinkState', 'type': 'str'}, + 'last_connected_time': {'key': 'properties.lastConnectedTime', 'type': 'str'}, + 'device_connection_status': {'key': 'properties.deviceConnectionStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LinkedSubscription, self).__init__(**kwargs) + self.linked_subscription_id = kwargs.get('linked_subscription_id', None) + self.registration_resource_id = kwargs.get('registration_resource_id', None) + self.device_id = None + self.device_object_id = None + self.device_link_state = None + self.last_connected_time = None + self.device_connection_status = None + + +class LinkedSubscriptionParameter(msrest.serialization.Model): + """Linked Subscription resource. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Location of the resource. Possible values include: "global". + :type location: str or ~azure.mgmt.azurestack.models.Location + :param linked_subscription_id: Required. The identifier associated with the device + subscription. + :type linked_subscription_id: str + :param registration_resource_id: Required. The identifier associated with the device + registration. + :type registration_resource_id: str + """ + + _validation = { + 'location': {'required': True}, + 'linked_subscription_id': {'required': True}, + 'registration_resource_id': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'linked_subscription_id': {'key': 'properties.linkedSubscriptionId', 'type': 'str'}, + 'registration_resource_id': {'key': 'properties.registrationResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LinkedSubscriptionParameter, self).__init__(**kwargs) + self.location = kwargs['location'] + self.linked_subscription_id = kwargs['linked_subscription_id'] + self.registration_resource_id = kwargs['registration_resource_id'] + + +class LinkedSubscriptionsList(msrest.serialization.Model): + """List of linked subscriptions with paging support. + + :param next_link: URI to the next page. + :type next_link: str + :param value: List of Linked Subscriptions. + :type value: list[~azure.mgmt.azurestack.models.LinkedSubscription] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[LinkedSubscription]'}, + } + + def __init__( + self, + **kwargs + ): + super(LinkedSubscriptionsList, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + class MarketplaceProductLogUpdate(msrest.serialization.Model): """Update details for product log. @@ -820,6 +1033,8 @@ class Product(Resource): :vartype type: str :param etag: The entity tag used for optimistic concurrency when modifying the resource. :type etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData :param display_name: The display name of the product. :type display_name: str :param description: The description of the product. @@ -862,6 +1077,7 @@ class Product(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -869,6 +1085,7 @@ class Product(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'publisher_display_name': {'key': 'properties.publisherDisplayName', 'type': 'str'}, @@ -894,6 +1111,7 @@ def __init__( **kwargs ): super(Product, self).__init__(**kwargs) + self.system_data = None self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) self.publisher_display_name = kwargs.get('publisher_display_name', None) @@ -1054,56 +1272,6 @@ def __init__( self.version = kwargs.get('version', None) -class TrackedResource(msrest.serialization.Model): - """Base resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.etag = kwargs.get('etag', None) - - class Registration(TrackedResource): """Registration information. @@ -1117,6 +1285,10 @@ class Registration(TrackedResource): :vartype name: str :ivar type: Type of Resource. :vartype type: str + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData :param location: Required. Location of the resource. Possible values include: "global". :type location: str or ~azure.mgmt.azurestack.models.Location :param tags: A set of tags. Custom tags for the resource. @@ -1135,6 +1307,8 @@ class Registration(TrackedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, } @@ -1142,6 +1316,8 @@ class Registration(TrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, @@ -1211,3 +1387,44 @@ def __init__( super(RegistrationParameter, self).__init__(**kwargs) self.location = kwargs['location'] self.registration_token = kwargs['registration_token'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py index a21d415e7698..8117e67254d1 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/models/_models_py3.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError @@ -229,6 +230,8 @@ class CustomerSubscription(Resource): :vartype type: str :param etag: The entity tag used for optimistic concurrency when modifying the resource. :type etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -237,6 +240,7 @@ class CustomerSubscription(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -244,6 +248,7 @@ class CustomerSubscription(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, } @@ -255,6 +260,7 @@ def __init__( **kwargs ): super(CustomerSubscription, self).__init__(etag=etag, **kwargs) + self.system_data = None self.tenant_id = tenant_id @@ -728,6 +734,231 @@ def __init__( self.hero = hero +class TrackedResource(msrest.serialization.Model): + """Base resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ID of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of Resource. + :vartype type: str + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData + :param location: Required. Location of the resource. Possible values include: "global". + :type location: str or ~azure.mgmt.azurestack.models.Location + :param tags: A set of tags. Custom tags for the resource. + :type tags: dict[str, str] + :param etag: The entity tag used for optimistic concurrency when modifying the resource. + :type etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Union[str, "Location"], + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kind = None + self.system_data = None + self.location = location + self.tags = tags + self.etag = etag + + +class LinkedSubscription(TrackedResource): + """Linked Subscription information. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: ID of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of Resource. + :vartype type: str + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData + :param location: Required. Location of the resource. Possible values include: "global". + :type location: str or ~azure.mgmt.azurestack.models.Location + :param tags: A set of tags. Custom tags for the resource. + :type tags: dict[str, str] + :param etag: The entity tag used for optimistic concurrency when modifying the resource. + :type etag: str + :param linked_subscription_id: The identifier associated with the device subscription. + :type linked_subscription_id: str + :param registration_resource_id: The identifier associated with the device registration. + :type registration_resource_id: str + :ivar device_id: The identifier of the Azure Stack device for remote management. + :vartype device_id: str + :ivar device_object_id: The object identifier associated with the Azure Stack device connecting + to Azure. + :vartype device_object_id: str + :ivar device_link_state: The connection state of the Azure Stack device. + :vartype device_link_state: str + :ivar last_connected_time: The last remote management connection time for the Azure Stack + device connected to the linked subscription resource. + :vartype last_connected_time: str + :ivar device_connection_status: The status of the remote management connection of the Azure + Stack device. + :vartype device_connection_status: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'device_id': {'readonly': True}, + 'device_object_id': {'readonly': True}, + 'device_link_state': {'readonly': True}, + 'last_connected_time': {'readonly': True}, + 'device_connection_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'linked_subscription_id': {'key': 'properties.linkedSubscriptionId', 'type': 'str'}, + 'registration_resource_id': {'key': 'properties.registrationResourceId', 'type': 'str'}, + 'device_id': {'key': 'properties.deviceId', 'type': 'str'}, + 'device_object_id': {'key': 'properties.deviceObjectId', 'type': 'str'}, + 'device_link_state': {'key': 'properties.deviceLinkState', 'type': 'str'}, + 'last_connected_time': {'key': 'properties.lastConnectedTime', 'type': 'str'}, + 'device_connection_status': {'key': 'properties.deviceConnectionStatus', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Union[str, "Location"], + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + linked_subscription_id: Optional[str] = None, + registration_resource_id: Optional[str] = None, + **kwargs + ): + super(LinkedSubscription, self).__init__(location=location, tags=tags, etag=etag, **kwargs) + self.linked_subscription_id = linked_subscription_id + self.registration_resource_id = registration_resource_id + self.device_id = None + self.device_object_id = None + self.device_link_state = None + self.last_connected_time = None + self.device_connection_status = None + + +class LinkedSubscriptionParameter(msrest.serialization.Model): + """Linked Subscription resource. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. Location of the resource. Possible values include: "global". + :type location: str or ~azure.mgmt.azurestack.models.Location + :param linked_subscription_id: Required. The identifier associated with the device + subscription. + :type linked_subscription_id: str + :param registration_resource_id: Required. The identifier associated with the device + registration. + :type registration_resource_id: str + """ + + _validation = { + 'location': {'required': True}, + 'linked_subscription_id': {'required': True}, + 'registration_resource_id': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'linked_subscription_id': {'key': 'properties.linkedSubscriptionId', 'type': 'str'}, + 'registration_resource_id': {'key': 'properties.registrationResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Union[str, "Location"], + linked_subscription_id: str, + registration_resource_id: str, + **kwargs + ): + super(LinkedSubscriptionParameter, self).__init__(**kwargs) + self.location = location + self.linked_subscription_id = linked_subscription_id + self.registration_resource_id = registration_resource_id + + +class LinkedSubscriptionsList(msrest.serialization.Model): + """List of linked subscriptions with paging support. + + :param next_link: URI to the next page. + :type next_link: str + :param value: List of Linked Subscriptions. + :type value: list[~azure.mgmt.azurestack.models.LinkedSubscription] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[LinkedSubscription]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["LinkedSubscription"]] = None, + **kwargs + ): + super(LinkedSubscriptionsList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + class MarketplaceProductLogUpdate(msrest.serialization.Model): """Update details for product log. @@ -870,6 +1101,8 @@ class Product(Resource): :vartype type: str :param etag: The entity tag used for optimistic concurrency when modifying the resource. :type etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData :param display_name: The display name of the product. :type display_name: str :param description: The description of the product. @@ -912,6 +1145,7 @@ class Product(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { @@ -919,6 +1153,7 @@ class Product(Resource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'publisher_display_name': {'key': 'properties.publisherDisplayName', 'type': 'str'}, @@ -964,6 +1199,7 @@ def __init__( **kwargs ): super(Product, self).__init__(etag=etag, **kwargs) + self.system_data = None self.display_name = display_name self.description = description self.publisher_display_name = publisher_display_name @@ -1132,60 +1368,6 @@ def __init__( self.version = version -class TrackedResource(msrest.serialization.Model): - """Base resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of Resource. - :vartype type: str - :param location: Required. Location of the resource. Possible values include: "global". - :type location: str or ~azure.mgmt.azurestack.models.Location - :param tags: A set of tags. Custom tags for the resource. - :type tags: dict[str, str] - :param etag: The entity tag used for optimistic concurrency when modifying the resource. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - *, - location: Union[str, "Location"], - tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.etag = etag - - class Registration(TrackedResource): """Registration information. @@ -1199,6 +1381,10 @@ class Registration(TrackedResource): :vartype name: str :ivar type: Type of Resource. :vartype type: str + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.azurestack.models.SystemData :param location: Required. Location of the resource. Possible values include: "global". :type location: str or ~azure.mgmt.azurestack.models.Location :param tags: A set of tags. Custom tags for the resource. @@ -1217,6 +1403,8 @@ class Registration(TrackedResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'kind': {'readonly': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, } @@ -1224,6 +1412,8 @@ class Registration(TrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'etag': {'key': 'etag', 'type': 'str'}, @@ -1306,3 +1496,51 @@ def __init__( super(RegistrationParameter, self).__init__(**kwargs) self.location = location self.registration_token = registration_token + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.azurestack.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/__init__.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/__init__.py index 22ab8459e498..dccefb1018e3 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/__init__.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/__init__.py @@ -8,14 +8,16 @@ from ._operations import Operations from ._cloud_manifest_file_operations import CloudManifestFileOperations +from ._customer_subscriptions_operations import CustomerSubscriptionsOperations from ._products_operations import ProductsOperations from ._registrations_operations import RegistrationsOperations -from ._customer_subscriptions_operations import CustomerSubscriptionsOperations +from ._linked_subscriptions_operations import LinkedSubscriptionsOperations __all__ = [ 'Operations', 'CloudManifestFileOperations', + 'CustomerSubscriptionsOperations', 'ProductsOperations', 'RegistrationsOperations', - 'CustomerSubscriptionsOperations', + 'LinkedSubscriptionsOperations', ] diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py index cb73409f2649..f52f3edde7cd 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py @@ -61,7 +61,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -81,7 +81,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) @@ -115,7 +115,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -141,7 +141,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CloudManifestFileResponse', pipeline_response) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py index d8634e45e76b..4aeefc291cd6 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_customer_subscriptions_operations.py @@ -68,7 +68,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -110,7 +110,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -147,7 +147,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -174,7 +174,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) @@ -211,7 +211,8 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -229,6 +230,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -236,7 +238,8 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) @@ -272,7 +275,7 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -304,7 +307,8 @@ def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CustomerSubscription', pipeline_response) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py new file mode 100644 index 000000000000..fee017626afc --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_linked_subscriptions_operations.py @@ -0,0 +1,443 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class LinkedSubscriptionsOperations(object): + """LinkedSubscriptionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestack.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.LinkedSubscriptionsList"] + """Returns a list of all linked subscriptions under current resource group. + + :param resource_group: Name of the resource group. + :type resource_group: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.LinkedSubscriptionsList"] + """Returns a list of all linked subscriptions under current subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LinkedSubscriptionsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestack.models.LinkedSubscriptionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscriptionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('LinkedSubscriptionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStack/linkedSubscriptions'} # type: ignore + + def get( + self, + resource_group, # type: str + linked_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LinkedSubscription" + """Returns the properties of a Linked Subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LinkedSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.azurestack.models.LinkedSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + def delete( + self, + resource_group, # type: str + linked_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the requested Linked Subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + def create_or_update( + self, + resource_group, # type: str + linked_subscription_name, # type: str + resource, # type: "_models.LinkedSubscriptionParameter" + **kwargs # type: Any + ): + # type: (...) -> "_models.LinkedSubscription" + """Create or update a linked subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :param resource: Linked subscription resource parameter. + :type resource: ~azure.mgmt.azurestack.models.LinkedSubscriptionParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LinkedSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.azurestack.models.LinkedSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore + + def update( + self, + resource_group, # type: str + linked_subscription_name, # type: str + resource, # type: "_models.LinkedSubscriptionParameter" + **kwargs # type: Any + ): + # type: (...) -> "_models.LinkedSubscription" + """Patch a Linked Subscription resource. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param linked_subscription_name: Name of the Linked Subscription resource. + :type linked_subscription_name: str + :param resource: Linked subscription resource parameter. + :type resource: ~azure.mgmt.azurestack.models.LinkedSubscriptionParameter + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LinkedSubscription, or the result of cls(response) + :rtype: ~azure.mgmt.azurestack.models.LinkedSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkedSubscription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'linkedSubscriptionName': self._serialize.url("linked_subscription_name", linked_subscription_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'LinkedSubscriptionParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LinkedSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/linkedSubscriptions/{linkedSubscriptionName}'} # type: ignore diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py index a06d275e997e..36fe2ccc45a5 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_operations.py @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -98,8 +98,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py index 305d1eae6d74..49c04c7bba85 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_products_operations.py @@ -68,7 +68,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -110,7 +110,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -147,7 +147,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -174,7 +174,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -211,7 +211,7 @@ def list_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -238,7 +238,8 @@ def list_details( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtendedProduct', pipeline_response) @@ -252,6 +253,7 @@ def get_products( self, resource_group, # type: str registration_name, # type: str + product_name, # type: str device_configuration=None, # type: Optional["_models.DeviceConfiguration"] **kwargs # type: Any ): @@ -262,6 +264,8 @@ def get_products( :type resource_group: str :param registration_name: Name of the Azure Stack registration. :type registration_name: str + :param product_name: Name of the product. + :type product_name: str :param device_configuration: Device configuration. :type device_configuration: ~azure.mgmt.azurestack.models.DeviceConfiguration :keyword callable cls: A custom type or function that will be passed the direct response @@ -274,7 +278,7 @@ def get_products( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -284,6 +288,7 @@ def get_products( 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), + 'productName': self._serialize.url("product_name", product_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -308,7 +313,7 @@ def get_products( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductList', pipeline_response) @@ -317,7 +322,7 @@ def get_products( return cls(pipeline_response, deserialized, {}) return deserialized - get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/_all/GetProducts'} # type: ignore + get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts'} # type: ignore def get_product( self, @@ -348,7 +353,7 @@ def get_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -383,7 +388,7 @@ def get_product( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Product', pipeline_response) @@ -392,7 +397,7 @@ def get_product( return cls(pipeline_response, deserialized, {}) return deserialized - get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/GetProduct'} # type: ignore + get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct'} # type: ignore def upload_log( self, @@ -423,7 +428,7 @@ def upload_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -458,7 +463,7 @@ def upload_log( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ProductLog', pipeline_response) diff --git a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py index abf4499e15d6..043eed7022ed 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_registrations_operations.py @@ -65,7 +65,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -106,7 +106,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -140,7 +140,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -166,7 +166,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -200,7 +200,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -226,7 +226,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -260,7 +260,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -291,7 +291,8 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Registration', pipeline_response) @@ -331,7 +332,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -362,7 +363,7 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Registration', pipeline_response) @@ -396,7 +397,7 @@ def get_activation_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-06-01" + api_version = "2020-06-01-preview" accept = "application/json" # Construct URL @@ -422,7 +423,8 @@ def get_activation_key( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ActivationKeyResult', pipeline_response) @@ -431,3 +433,58 @@ def get_activation_key( return deserialized get_activation_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey'} # type: ignore + + def enable_remote_management( + self, + resource_group, # type: str + registration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Enables remote management for device under the Azure Stack registration. + + :param resource_group: Name of the resource group. + :type resource_group: str + :param registration_name: Name of the Azure Stack registration. + :type registration_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.enable_remote_management.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'registrationName': self._serialize.url("registration_name", registration_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + enable_remote_management.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement'} # type: ignore diff --git a/sdk/azurestack/azure-mgmt-azurestack/setup.py b/sdk/azurestack/azure-mgmt-azurestack/setup.py index 16b6ee32d3dc..5be9a70cfcc7 100644 --- a/sdk/azurestack/azure-mgmt-azurestack/setup.py +++ b/sdk/azurestack/azure-mgmt-azurestack/setup.py @@ -78,7 +78,7 @@ 'azure.mgmt', ]), install_requires=[ - 'msrest>=0.5.0', + 'msrest>=0.6.21', 'azure-common~=1.1', 'azure-mgmt-core>=1.2.0,<2.0.0', ], diff --git a/shared_requirements.txt b/shared_requirements.txt index 1edc17a7d9e3..a9d2f36ccb35 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -208,8 +208,8 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-labservices msrest>=0.6.21 #override azure-mgmt-loganalytics msrest>=0.6.21 #override azure-mgmt-synapse msrest>=0.6.21 +#override azure-mgmt-azurestack msrest>=0.6.21 #override azure-mgmt-compute msrest>=0.6.21 #override azure-mgmt-storagesync msrest>=0.6.21 -#override azure-mgmt-compute msrest>=0.6.21 #override azure-mgmt-resourcegraph msrest>=0.6.21 #override azure-mgmt-containerservice msrest>=0.6.21