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 46dcad8f1bcc..c2fd1928c1ff 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 @@ -14,6 +14,7 @@ from ._configuration import AzureStackManagementClientConfiguration from .operations import Operations +from .operations import CloudManifestFileOperations from .operations import ProductsOperations from .operations import RegistrationsOperations from .operations import CustomerSubscriptionsOperations @@ -28,6 +29,8 @@ class AzureStackManagementClient(SDKClient): :ivar operations: Operations operations :vartype operations: azure.mgmt.azurestack.operations.Operations + :ivar cloud_manifest_file: CloudManifestFile operations + :vartype cloud_manifest_file: azure.mgmt.azurestack.operations.CloudManifestFileOperations :ivar products: Products operations :vartype products: azure.mgmt.azurestack.operations.ProductsOperations :ivar registrations: Registrations operations @@ -58,6 +61,8 @@ def __init__( self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) + self.cloud_manifest_file = CloudManifestFileOperations( + self._client, self.config, self._serialize, self._deserialize) self.products = ProductsOperations( self._client, self.config, self._serialize, self._deserialize) self.registrations = RegistrationsOperations( 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 5aba3e6d7eec..4699a6c54155 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 @@ -11,6 +11,9 @@ try: from ._models_py3 import ActivationKeyResult + from ._models_py3 import CloudManifestFileDeploymentData + from ._models_py3 import CloudManifestFileProperties + from ._models_py3 import CloudManifestFileResponse from ._models_py3 import Compatibility from ._models_py3 import CustomerSubscription from ._models_py3 import DataDiskImage @@ -36,6 +39,9 @@ from ._models_py3 import VirtualMachineProductProperties except (SyntaxError, ImportError): from ._models import ActivationKeyResult + from ._models import CloudManifestFileDeploymentData + from ._models import CloudManifestFileProperties + from ._models import CloudManifestFileResponse from ._models import Compatibility from ._models import CustomerSubscription from ._models import DataDiskImage @@ -69,11 +75,13 @@ OperatingSystem, CompatibilityIssue, Category, - Location, ) __all__ = [ 'ActivationKeyResult', + 'CloudManifestFileDeploymentData', + 'CloudManifestFileProperties', + 'CloudManifestFileResponse', 'Compatibility', 'CustomerSubscription', 'DataDiskImage', @@ -106,5 +114,4 @@ 'OperatingSystem', 'CompatibilityIssue', 'Category', - 'Location', ] 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 d819ad990f80..ed8a3f5bf6b3 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 @@ -52,8 +52,3 @@ class Category(str, Enum): azure_ad = "AzureAD" adfs = "ADFS" - - -class Location(str, Enum): - - global_enum = "global" 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 1b1788792552..dd302f31ce37 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 @@ -37,34 +37,53 @@ class CloudError(Model): } -class Compatibility(Model): - """Product compatibility. +class CloudManifestFileDeploymentData(Model): + """Cloud specific manifest data for AzureStack deployment. + + :param external_dsms_certificates: Dsms external certificates. + :type external_dsms_certificates: str + :param custom_cloud_verification_key: Signing verification public key. + :type custom_cloud_verification_key: str + :param custom_cloud_arm_endpoint: ARM endpoint. + :type custom_cloud_arm_endpoint: str + :param external_dsms_endpoint: Dsms endpoint. + :type external_dsms_endpoint: str + """ - :param is_compatible: Tells if product is compatible with current device - :type is_compatible: bool - :param message: Short error message if any compatibility issues are found - :type message: str - :param description: Full error message if any compatibility issues are - found - :type description: str - :param issues: List of all issues found - :type issues: list[str or - ~azure.mgmt.azurestack.models.CompatibilityIssue] + _attribute_map = { + 'external_dsms_certificates': {'key': 'externalDsmsCertificates', 'type': 'str'}, + 'custom_cloud_verification_key': {'key': 'customCloudVerificationKey', 'type': 'str'}, + 'custom_cloud_arm_endpoint': {'key': 'customEnvironmentEndpoints.customCloudArmEndpoint', 'type': 'str'}, + 'external_dsms_endpoint': {'key': 'customEnvironmentEndpoints.externalDsmsEndpoint', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CloudManifestFileDeploymentData, self).__init__(**kwargs) + self.external_dsms_certificates = kwargs.get('external_dsms_certificates', None) + self.custom_cloud_verification_key = kwargs.get('custom_cloud_verification_key', None) + self.custom_cloud_arm_endpoint = kwargs.get('custom_cloud_arm_endpoint', None) + self.external_dsms_endpoint = kwargs.get('external_dsms_endpoint', None) + + +class CloudManifestFileProperties(Model): + """Cloud specific manifest JSON properties. + + :param deployment_data: Cloud specific manifest data. + :type deployment_data: + ~azure.mgmt.azurestack.models.CloudManifestFileDeploymentData + :param signature: Signature of the cloud specific manifest data. + :type signature: str """ _attribute_map = { - 'is_compatible': {'key': 'isCompatible', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'issues': {'key': 'issues', 'type': '[str]'}, + 'deployment_data': {'key': 'deploymentData', 'type': 'CloudManifestFileDeploymentData'}, + 'signature': {'key': 'signature', 'type': 'str'}, } def __init__(self, **kwargs): - super(Compatibility, self).__init__(**kwargs) - self.is_compatible = kwargs.get('is_compatible', None) - self.message = kwargs.get('message', None) - self.description = kwargs.get('description', None) - self.issues = kwargs.get('issues', None) + super(CloudManifestFileProperties, self).__init__(**kwargs) + self.deployment_data = kwargs.get('deployment_data', None) + self.signature = kwargs.get('signature', None) class Resource(Model): @@ -105,6 +124,75 @@ def __init__(self, **kwargs): self.etag = kwargs.get('etag', None) +class CloudManifestFileResponse(Resource): + """Cloud specific manifest GET response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :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 etag: The entity tag used for optimistic concurrency when modifying + the resource. + :type etag: str + :param properties: Cloud specific manifest data. + :type properties: + ~azure.mgmt.azurestack.models.CloudManifestFileProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CloudManifestFileProperties'}, + } + + def __init__(self, **kwargs): + super(CloudManifestFileResponse, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class Compatibility(Model): + """Product compatibility. + + :param is_compatible: Tells if product is compatible with current device + :type is_compatible: bool + :param message: Short error message if any compatibility issues are found + :type message: str + :param description: Full error message if any compatibility issues are + found + :type description: str + :param issues: List of all issues found + :type issues: list[str or + ~azure.mgmt.azurestack.models.CompatibilityIssue] + """ + + _attribute_map = { + 'is_compatible': {'key': 'isCompatible', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'issues': {'key': 'issues', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Compatibility, self).__init__(**kwargs) + self.is_compatible = kwargs.get('is_compatible', None) + self.message = kwargs.get('message', None) + self.description = kwargs.get('description', None) + self.issues = kwargs.get('issues', None) + + class CustomerSubscription(Resource): """Customer subscription. @@ -855,18 +943,22 @@ def __init__(self, **kwargs): class RegistrationParameter(Model): """Registration resource. + 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. :param registration_token: Required. The token identifying registered Azure Stack :type registration_token: str - :param location: Location of the resource. Possible values include: - 'global' - :type location: str or ~azure.mgmt.azurestack.models.Location + :ivar location: Required. Location of the resource. Default value: + "global" . + :vartype location: str """ _validation = { 'registration_token': {'required': True}, + 'location': {'required': True, 'constant': True}, } _attribute_map = { @@ -874,10 +966,11 @@ class RegistrationParameter(Model): 'location': {'key': 'location', 'type': 'str'}, } + location = "global" + def __init__(self, **kwargs): super(RegistrationParameter, self).__init__(**kwargs) self.registration_token = kwargs.get('registration_token', None) - self.location = kwargs.get('location', None) class VirtualMachineExtensionProductProperties(Model): 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 322590fdb8bc..7ca89183d19a 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 @@ -37,34 +37,53 @@ class CloudError(Model): } -class Compatibility(Model): - """Product compatibility. +class CloudManifestFileDeploymentData(Model): + """Cloud specific manifest data for AzureStack deployment. + + :param external_dsms_certificates: Dsms external certificates. + :type external_dsms_certificates: str + :param custom_cloud_verification_key: Signing verification public key. + :type custom_cloud_verification_key: str + :param custom_cloud_arm_endpoint: ARM endpoint. + :type custom_cloud_arm_endpoint: str + :param external_dsms_endpoint: Dsms endpoint. + :type external_dsms_endpoint: str + """ - :param is_compatible: Tells if product is compatible with current device - :type is_compatible: bool - :param message: Short error message if any compatibility issues are found - :type message: str - :param description: Full error message if any compatibility issues are - found - :type description: str - :param issues: List of all issues found - :type issues: list[str or - ~azure.mgmt.azurestack.models.CompatibilityIssue] + _attribute_map = { + 'external_dsms_certificates': {'key': 'externalDsmsCertificates', 'type': 'str'}, + 'custom_cloud_verification_key': {'key': 'customCloudVerificationKey', 'type': 'str'}, + 'custom_cloud_arm_endpoint': {'key': 'customEnvironmentEndpoints.customCloudArmEndpoint', 'type': 'str'}, + 'external_dsms_endpoint': {'key': 'customEnvironmentEndpoints.externalDsmsEndpoint', 'type': 'str'}, + } + + def __init__(self, *, external_dsms_certificates: str=None, custom_cloud_verification_key: str=None, custom_cloud_arm_endpoint: str=None, external_dsms_endpoint: str=None, **kwargs) -> None: + super(CloudManifestFileDeploymentData, self).__init__(**kwargs) + self.external_dsms_certificates = external_dsms_certificates + self.custom_cloud_verification_key = custom_cloud_verification_key + self.custom_cloud_arm_endpoint = custom_cloud_arm_endpoint + self.external_dsms_endpoint = external_dsms_endpoint + + +class CloudManifestFileProperties(Model): + """Cloud specific manifest JSON properties. + + :param deployment_data: Cloud specific manifest data. + :type deployment_data: + ~azure.mgmt.azurestack.models.CloudManifestFileDeploymentData + :param signature: Signature of the cloud specific manifest data. + :type signature: str """ _attribute_map = { - 'is_compatible': {'key': 'isCompatible', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'issues': {'key': 'issues', 'type': '[str]'}, + 'deployment_data': {'key': 'deploymentData', 'type': 'CloudManifestFileDeploymentData'}, + 'signature': {'key': 'signature', 'type': 'str'}, } - def __init__(self, *, is_compatible: bool=None, message: str=None, description: str=None, issues=None, **kwargs) -> None: - super(Compatibility, self).__init__(**kwargs) - self.is_compatible = is_compatible - self.message = message - self.description = description - self.issues = issues + def __init__(self, *, deployment_data=None, signature: str=None, **kwargs) -> None: + super(CloudManifestFileProperties, self).__init__(**kwargs) + self.deployment_data = deployment_data + self.signature = signature class Resource(Model): @@ -105,6 +124,75 @@ def __init__(self, *, etag: str=None, **kwargs) -> None: self.etag = etag +class CloudManifestFileResponse(Resource): + """Cloud specific manifest GET response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :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 etag: The entity tag used for optimistic concurrency when modifying + the resource. + :type etag: str + :param properties: Cloud specific manifest data. + :type properties: + ~azure.mgmt.azurestack.models.CloudManifestFileProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CloudManifestFileProperties'}, + } + + def __init__(self, *, etag: str=None, properties=None, **kwargs) -> None: + super(CloudManifestFileResponse, self).__init__(etag=etag, **kwargs) + self.properties = properties + + +class Compatibility(Model): + """Product compatibility. + + :param is_compatible: Tells if product is compatible with current device + :type is_compatible: bool + :param message: Short error message if any compatibility issues are found + :type message: str + :param description: Full error message if any compatibility issues are + found + :type description: str + :param issues: List of all issues found + :type issues: list[str or + ~azure.mgmt.azurestack.models.CompatibilityIssue] + """ + + _attribute_map = { + 'is_compatible': {'key': 'isCompatible', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'issues': {'key': 'issues', 'type': '[str]'}, + } + + def __init__(self, *, is_compatible: bool=None, message: str=None, description: str=None, issues=None, **kwargs) -> None: + super(Compatibility, self).__init__(**kwargs) + self.is_compatible = is_compatible + self.message = message + self.description = description + self.issues = issues + + class CustomerSubscription(Resource): """Customer subscription. @@ -855,18 +943,22 @@ def __init__(self, *, tags=None, etag: str=None, object_id: str=None, cloud_id: class RegistrationParameter(Model): """Registration resource. + 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. :param registration_token: Required. The token identifying registered Azure Stack :type registration_token: str - :param location: Location of the resource. Possible values include: - 'global' - :type location: str or ~azure.mgmt.azurestack.models.Location + :ivar location: Required. Location of the resource. Default value: + "global" . + :vartype location: str """ _validation = { 'registration_token': {'required': True}, + 'location': {'required': True, 'constant': True}, } _attribute_map = { @@ -874,10 +966,11 @@ class RegistrationParameter(Model): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, registration_token: str, location=None, **kwargs) -> None: + location = "global" + + def __init__(self, *, registration_token: str, **kwargs) -> None: super(RegistrationParameter, self).__init__(**kwargs) self.registration_token = registration_token - self.location = location class VirtualMachineExtensionProductProperties(Model): 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 c19768fd4c6b..1b357c4b8cef 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 @@ -10,12 +10,14 @@ # -------------------------------------------------------------------------- from ._operations import Operations +from ._cloud_manifest_file_operations import CloudManifestFileOperations from ._products_operations import ProductsOperations from ._registrations_operations import RegistrationsOperations from ._customer_subscriptions_operations import CustomerSubscriptionsOperations __all__ = [ 'Operations', + 'CloudManifestFileOperations', 'ProductsOperations', 'RegistrationsOperations', 'CustomerSubscriptionsOperations', 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 new file mode 100644 index 000000000000..2717ab822ad0 --- /dev/null +++ b/sdk/azurestack/azure-mgmt-azurestack/azure/mgmt/azurestack/operations/_cloud_manifest_file_operations.py @@ -0,0 +1,150 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class CloudManifestFileOperations(object): + """CloudManifestFileOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API Version. Constant value: "2017-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-06-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Returns a cloud specific manifest JSON file with latest version. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CloudManifestFileResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.azurestack.models.CloudManifestFileResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CloudManifestFileResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.AzureStack/cloudManifestFiles'} + + def get( + self, verification_version, version_creation_date=None, custom_headers=None, raw=False, **operation_config): + """Returns a cloud specific manifest JSON file. + + :param verification_version: Signing verification key version. + :type verification_version: str + :param version_creation_date: Signing verification key version + creation date. + :type version_creation_date: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CloudManifestFileResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.azurestack.models.CloudManifestFileResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'verificationVersion': self._serialize.url("verification_version", verification_version, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if version_creation_date is not None: + query_parameters['versionCreationDate'] = self._serialize.query("version_creation_date", version_creation_date, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CloudManifestFileResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.AzureStack/cloudManifestFiles/{verificationVersion}'} 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 ae9c17565a78..53d83366fff8 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -190,7 +189,8 @@ def delete( overrides`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -220,9 +220,7 @@ def delete( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) @@ -252,7 +250,8 @@ def create( :return: CustomerSubscription or ClientRawResponse if raw=true :rtype: ~azure.mgmt.azurestack.models.CustomerSubscription or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ customer_creation_parameters = models.CustomerSubscription(etag=etag, tenant_id=tenant_id) @@ -289,9 +288,7 @@ def create( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: 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 30448f634809..f91cea3b1b38 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -51,7 +50,8 @@ def list( :return: An iterator like instance of Operation :rtype: ~azure.mgmt.azurestack.models.OperationPaged[~azure.mgmt.azurestack.models.Operation] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -86,9 +86,7 @@ def internal_paging(next_link=None): response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) return 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 4407fc0cf1a5..9dfd0ff97bcd 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -191,7 +190,8 @@ def list_details( :return: ExtendedProduct or ClientRawResponse if raw=true :rtype: ~azure.mgmt.azurestack.models.ExtendedProduct or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.list_details.metadata['url'] @@ -222,9 +222,7 @@ def list_details( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -238,13 +236,15 @@ def list_details( list_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listDetails'} def get_products( - self, resource_group, registration_name, custom_headers=None, raw=False, **operation_config): + self, resource_group, registration_name, product_name, custom_headers=None, raw=False, **operation_config): """Returns a list of products. :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 + :param product_name: Name of the product. + :type product_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -263,7 +263,8 @@ def get_products( 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') + '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) @@ -304,7 +305,7 @@ def get_products( return client_raw_response return deserialized - get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/_all/GetProducts'} + get_products.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProducts'} def get_product( self, resource_group, registration_name, product_name, custom_headers=None, raw=False, **operation_config): @@ -376,7 +377,7 @@ def get_product( return client_raw_response return deserialized - get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/GetProduct'} + get_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/getProduct'} def upload_log( self, resource_group, registration_name, product_name, custom_headers=None, raw=False, **operation_config): 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 c9a69428b993..468aff15da19 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -220,7 +219,7 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} def create_or_update( - self, resource_group, registration_name, registration_token, location=None, custom_headers=None, raw=False, **operation_config): + self, resource_group, registration_name, registration_token, custom_headers=None, raw=False, **operation_config): """Create or update an Azure Stack registration. :param resource_group: Name of the resource group. @@ -230,9 +229,6 @@ def create_or_update( :param registration_token: The token identifying registered Azure Stack :type registration_token: str - :param location: Location of the resource. Possible values include: - 'global' - :type location: str or ~azure.mgmt.azurestack.models.Location :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -241,9 +237,10 @@ def create_or_update( :return: Registration or ClientRawResponse if raw=true :rtype: ~azure.mgmt.azurestack.models.Registration or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ - token = models.RegistrationParameter(registration_token=registration_token, location=location) + token = models.RegistrationParameter(registration_token=registration_token) # Construct URL url = self.create_or_update.metadata['url'] @@ -277,9 +274,7 @@ def create_or_update( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -295,7 +290,7 @@ def create_or_update( create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}'} def update( - self, resource_group, registration_name, registration_token, location=None, custom_headers=None, raw=False, **operation_config): + self, resource_group, registration_name, registration_token, custom_headers=None, raw=False, **operation_config): """Patch an Azure Stack registration. :param resource_group: Name of the resource group. @@ -305,9 +300,6 @@ def update( :param registration_token: The token identifying registered Azure Stack :type registration_token: str - :param location: Location of the resource. Possible values include: - 'global' - :type location: str or ~azure.mgmt.azurestack.models.Location :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -319,7 +311,7 @@ def update( :raises: :class:`ErrorResponseException` """ - token = models.RegistrationParameter(registration_token=registration_token, location=location) + token = models.RegistrationParameter(registration_token=registration_token) # Construct URL url = self.update.metadata['url'] @@ -382,7 +374,8 @@ def get_activation_key( :return: ActivationKeyResult or ClientRawResponse if raw=true :rtype: ~azure.mgmt.azurestack.models.ActivationKeyResult or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_activation_key.metadata['url'] @@ -412,9 +405,7 @@ def get_activation_key( response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -426,3 +417,55 @@ def get_activation_key( return deserialized get_activation_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey'} + + def enable_remote_management( + self, resource_group, registration_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.enable_remote_management.metadata['url'] + 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 = {} + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_remote_management.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/enableRemoteManagement'}