diff --git a/sdk/azure-mgmt/softwareplan/__init__.py b/sdk/azure-mgmt/softwareplan/__init__.py new file mode 100644 index 000000000000..38a6bbb7dc27 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/__init__.py @@ -0,0 +1,19 @@ +# 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 ._configuration import softwareplanClientConfiguration +from ._softwareplan_client import softwareplanClient +__all__ = ['softwareplanClient', 'softwareplanClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/azure-mgmt/softwareplan/_configuration.py b/sdk/azure-mgmt/softwareplan/_configuration.py new file mode 100644 index 000000000000..a5d6812d31e6 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/_configuration.py @@ -0,0 +1,48 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class softwareplanClientConfiguration(AzureConfiguration): + """Configuration for softwareplanClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(softwareplanClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('softwareplan/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/azure-mgmt/softwareplan/_softwareplan_client.py b/sdk/azure-mgmt/softwareplan/_softwareplan_client.py new file mode 100644 index 000000000000..be2942e58e8b --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/_softwareplan_client.py @@ -0,0 +1,64 @@ +# 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 msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import softwareplanClientConfiguration +from .operations import SoftwarePlanOperations +from .operations import HybridUseBenefitOperations +from .operations import HybridUseBenefitRevisionOperations +from .operations import Operations +from . import models + + +class softwareplanClient(SDKClient): + """Azure software plans let users create and manage licenses for various software used in Azure. + + :ivar config: Configuration for client. + :vartype config: softwareplanClientConfiguration + + :ivar software_plan: SoftwarePlan operations + :vartype software_plan: microsoft.softwareplan.operations.SoftwarePlanOperations + :ivar hybrid_use_benefit: HybridUseBenefit operations + :vartype hybrid_use_benefit: microsoft.softwareplan.operations.HybridUseBenefitOperations + :ivar hybrid_use_benefit_revision: HybridUseBenefitRevision operations + :vartype hybrid_use_benefit_revision: microsoft.softwareplan.operations.HybridUseBenefitRevisionOperations + :ivar operations: Operations operations + :vartype operations: microsoft.softwareplan.operations.Operations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = softwareplanClientConfiguration(credentials, subscription_id, base_url) + super(softwareplanClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-06-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.software_plan = SoftwarePlanOperations( + self._client, self.config, self._serialize, self._deserialize) + self.hybrid_use_benefit = HybridUseBenefitOperations( + self._client, self.config, self._serialize, self._deserialize) + self.hybrid_use_benefit_revision = HybridUseBenefitRevisionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/azure-mgmt/softwareplan/models/__init__.py b/sdk/azure-mgmt/softwareplan/models/__init__.py new file mode 100644 index 000000000000..476dd1250bce --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/models/__init__.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureEntityResource + from ._models_py3 import Error, ErrorException + from ._models_py3 import HybridUseBenefitModel + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationResponse + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import Sku + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import AzureEntityResource + from ._models import Error, ErrorException + from ._models import HybridUseBenefitModel + from ._models import OperationDisplay + from ._models import OperationResponse + from ._models import ProxyResource + from ._models import Resource + from ._models import Sku + from ._models import TrackedResource +from ._paged_models import HybridUseBenefitModelPaged +from ._paged_models import OperationResponsePaged +from ._softwareplan_client_enums import ( + ErrorCode, + ProvisioningState, +) + +__all__ = [ + 'AzureEntityResource', + 'Error', 'ErrorException', + 'HybridUseBenefitModel', + 'OperationDisplay', + 'OperationResponse', + 'ProxyResource', + 'Resource', + 'Sku', + 'TrackedResource', + 'HybridUseBenefitModelPaged', + 'OperationResponsePaged', + 'ErrorCode', + 'ProvisioningState', +] diff --git a/sdk/azure-mgmt/softwareplan/models/_models.py b/sdk/azure-mgmt/softwareplan/models/_models.py new file mode 100644 index 000000000000..5b2b03665b38 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/models/_models.py @@ -0,0 +1,333 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _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'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for a Azure Resource Manager resource with an + etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Error(Model): + """Error object returned by the RP. + + :param code: Error code. Possible values include: + 'InvalidRequestParameter', 'MissingRequestParameter' + :type code: str or ~microsoft.softwareplan.models.ErrorCode + :param message: A user readable error message. Localized based on + x-ms-effective-locale header in the request + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class ErrorException(HttpOperationError): + """Server responsed with exception of type: 'Error'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) + + +class HybridUseBenefitModel(Resource): + """Response on GET of a hybrid use benefit. + + 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: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param sku: Required. Hybrid use benefit SKU + :type sku: ~microsoft.softwareplan.models.Sku + :ivar etag: Indicates the revision of the hybrid use benefit + :vartype etag: int + :ivar provisioning_state: Provisioning state. Possible values include: + 'Succeeded', 'Cancelled', 'Failed' + :vartype provisioning_state: str or + ~microsoft.softwareplan.models.ProvisioningState + :ivar created_date: Created date + :vartype created_date: datetime + :ivar last_updated_date: Last Ureated date + :vartype last_updated_date: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'etag': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_date': {'readonly': True}, + 'last_updated_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'etag': {'key': 'etag', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_date': {'key': 'properties.createdDate', 'type': 'iso-8601'}, + 'last_updated_date': {'key': 'properties.lastUpdatedDate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(HybridUseBenefitModel, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.etag = None + self.provisioning_state = None + self.created_date = None + self.last_updated_date = None + + +class OperationDisplay(Model): + """Display fields for an operation. + + :param provider: Resource Provider name + :type provider: str + :param resource: Resource that is acted upon + :type resource: str + :param operation: Operation to be performed + :type operation: str + :param description: Description of the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationResponse(Model): + """Operation response. + + :param name: Name of the operation + :type name: str + :param display: Display properties for the operation + :type display: ~microsoft.softwareplan.models.OperationDisplay + :param origin: Origin of the response + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationResponse, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _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'}, + } + + def __init__(self, **kwargs): + super(ProxyResource, self).__init__(**kwargs) + + +class Sku(Model): + """The SKU to be applied for this resource. + + :param name: Name of the SKU to be applied + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: 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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) diff --git a/sdk/azure-mgmt/softwareplan/models/_models_py3.py b/sdk/azure-mgmt/softwareplan/models/_models_py3.py new file mode 100644 index 000000000000..d8ad52871a59 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/models/_models_py3.py @@ -0,0 +1,333 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Resource(Model): + """Resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _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'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AzureEntityResource(Resource): + """The resource model definition for a Azure Resource Manager resource with an + etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Error(Model): + """Error object returned by the RP. + + :param code: Error code. Possible values include: + 'InvalidRequestParameter', 'MissingRequestParameter' + :type code: str or ~microsoft.softwareplan.models.ErrorCode + :param message: A user readable error message. Localized based on + x-ms-effective-locale header in the request + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code=None, message: str=None, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorException(HttpOperationError): + """Server responsed with exception of type: 'Error'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) + + +class HybridUseBenefitModel(Resource): + """Response on GET of a hybrid use benefit. + + 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: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param sku: Required. Hybrid use benefit SKU + :type sku: ~microsoft.softwareplan.models.Sku + :ivar etag: Indicates the revision of the hybrid use benefit + :vartype etag: int + :ivar provisioning_state: Provisioning state. Possible values include: + 'Succeeded', 'Cancelled', 'Failed' + :vartype provisioning_state: str or + ~microsoft.softwareplan.models.ProvisioningState + :ivar created_date: Created date + :vartype created_date: datetime + :ivar last_updated_date: Last Ureated date + :vartype last_updated_date: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'sku': {'required': True}, + 'etag': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_date': {'readonly': True}, + 'last_updated_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'etag': {'key': 'etag', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'created_date': {'key': 'properties.createdDate', 'type': 'iso-8601'}, + 'last_updated_date': {'key': 'properties.lastUpdatedDate', 'type': 'iso-8601'}, + } + + def __init__(self, *, sku, **kwargs) -> None: + super(HybridUseBenefitModel, self).__init__(**kwargs) + self.sku = sku + self.etag = None + self.provisioning_state = None + self.created_date = None + self.last_updated_date = None + + +class OperationDisplay(Model): + """Display fields for an operation. + + :param provider: Resource Provider name + :type provider: str + :param resource: Resource that is acted upon + :type resource: str + :param operation: Operation to be performed + :type operation: str + :param description: Description of the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationResponse(Model): + """Operation response. + + :param name: Name of the operation + :type name: str + :param display: Display properties for the operation + :type display: ~microsoft.softwareplan.models.OperationDisplay + :param origin: Origin of the response + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, display=None, origin: str=None, **kwargs) -> None: + super(OperationResponse, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _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'}, + } + + def __init__(self, **kwargs) -> None: + super(ProxyResource, self).__init__(**kwargs) + + +class Sku(Model): + """The SKU to be applied for this resource. + + :param name: Name of the SKU to be applied + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: 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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location diff --git a/sdk/azure-mgmt/softwareplan/models/_paged_models.py b/sdk/azure-mgmt/softwareplan/models/_paged_models.py new file mode 100644 index 000000000000..b892c07b3152 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/models/_paged_models.py @@ -0,0 +1,40 @@ +# 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 msrest.paging import Paged + + +class HybridUseBenefitModelPaged(Paged): + """ + A paging container for iterating over a list of :class:`HybridUseBenefitModel ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[HybridUseBenefitModel]'} + } + + def __init__(self, *args, **kwargs): + + super(HybridUseBenefitModelPaged, self).__init__(*args, **kwargs) +class OperationResponsePaged(Paged): + """ + A paging container for iterating over a list of :class:`OperationResponse ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[OperationResponse]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationResponsePaged, self).__init__(*args, **kwargs) diff --git a/sdk/azure-mgmt/softwareplan/models/_softwareplan_client_enums.py b/sdk/azure-mgmt/softwareplan/models/_softwareplan_client_enums.py new file mode 100644 index 000000000000..97e53c0276b0 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/models/_softwareplan_client_enums.py @@ -0,0 +1,25 @@ +# 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 enum import Enum + + +class ErrorCode(str, Enum): + + invalid_request_parameter = "InvalidRequestParameter" + missing_request_parameter = "MissingRequestParameter" + + +class ProvisioningState(str, Enum): + + succeeded = "Succeeded" + cancelled = "Cancelled" + failed = "Failed" diff --git a/sdk/azure-mgmt/softwareplan/operations/__init__.py b/sdk/azure-mgmt/softwareplan/operations/__init__.py new file mode 100644 index 000000000000..e2734fdc8d28 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/operations/__init__.py @@ -0,0 +1,22 @@ +# 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 ._software_plan_operations import SoftwarePlanOperations +from ._hybrid_use_benefit_operations import HybridUseBenefitOperations +from ._hybrid_use_benefit_revision_operations import HybridUseBenefitRevisionOperations +from ._operations import Operations + +__all__ = [ + 'SoftwarePlanOperations', + 'HybridUseBenefitOperations', + 'HybridUseBenefitRevisionOperations', + 'Operations', +] diff --git a/sdk/azure-mgmt/softwareplan/operations/_hybrid_use_benefit_operations.py b/sdk/azure-mgmt/softwareplan/operations/_hybrid_use_benefit_operations.py new file mode 100644 index 000000000000..b56505907f89 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/operations/_hybrid_use_benefit_operations.py @@ -0,0 +1,368 @@ +# 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 HybridUseBenefitOperations(object): + """HybridUseBenefitOperations 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: The api-version to be used by the service. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def list( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Get all hybrid use benefits associated with an ARM resource. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: str + :param filter: Supports applying filter on the type of SKU + :type filter: 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: An iterator like instance of HybridUseBenefitModel + :rtype: + ~microsoft.softwareplan.models.HybridUseBenefitModelPaged[~microsoft.softwareplan.models.HybridUseBenefitModel] + :raises: + :class:`ErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.HybridUseBenefitModelPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits'} + + def create( + self, scope, plan_id, sku, custom_headers=None, raw=False, **operation_config): + """Create a new hybrid use benefit under a given scope. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: str + :param plan_id: This is a unique identifier for a plan. Should be a + guid. + :type plan_id: str + :param sku: Hybrid use benefit SKU + :type sku: ~microsoft.softwareplan.models.Sku + :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: HybridUseBenefitModel or ClientRawResponse if raw=true + :rtype: ~microsoft.softwareplan.models.HybridUseBenefitModel or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + body = models.HybridUseBenefitModel(sku=sku) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'planId': self._serialize.url("plan_id", plan_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'HybridUseBenefitModel') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HybridUseBenefitModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}'} + + def update( + self, scope, plan_id, sku, custom_headers=None, raw=False, **operation_config): + """Updates an existing hybrid use benefit. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: str + :param plan_id: This is a unique identifier for a plan. Should be a + guid. + :type plan_id: str + :param sku: Hybrid use benefit SKU + :type sku: ~microsoft.softwareplan.models.Sku + :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: HybridUseBenefitModel or ClientRawResponse if raw=true + :rtype: ~microsoft.softwareplan.models.HybridUseBenefitModel or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + body = models.HybridUseBenefitModel(sku=sku) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'planId': self._serialize.url("plan_id", plan_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'HybridUseBenefitModel') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HybridUseBenefitModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}'} + + def get( + self, scope, plan_id, custom_headers=None, raw=False, **operation_config): + """Gets a given plan ID. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: str + :param plan_id: This is a unique identifier for a plan. Should be a + guid. + :type plan_id: 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: HybridUseBenefitModel or ClientRawResponse if raw=true + :rtype: ~microsoft.softwareplan.models.HybridUseBenefitModel or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'planId': self._serialize.url("plan_id", plan_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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.ErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('HybridUseBenefitModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}'} + + def delete( + self, scope, plan_id, custom_headers=None, raw=False, **operation_config): + """Deletes a given plan ID. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: str + :param plan_id: This is a unique identifier for a plan. Should be a + guid. + :type plan_id: 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:`ErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'planId': self._serialize.url("plan_id", plan_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}'} diff --git a/sdk/azure-mgmt/softwareplan/operations/_hybrid_use_benefit_revision_operations.py b/sdk/azure-mgmt/softwareplan/operations/_hybrid_use_benefit_revision_operations.py new file mode 100644 index 000000000000..faa0d559e46d --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/operations/_hybrid_use_benefit_revision_operations.py @@ -0,0 +1,112 @@ +# 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 HybridUseBenefitRevisionOperations(object): + """HybridUseBenefitRevisionOperations 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: The api-version to be used by the service. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def list( + self, scope, plan_id, custom_headers=None, raw=False, **operation_config): + """Gets the version history of a hybrid use benefit. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: str + :param plan_id: This is a unique identifier for a plan. Should be a + guid. + :type plan_id: 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: An iterator like instance of HybridUseBenefitModel + :rtype: + ~microsoft.softwareplan.models.HybridUseBenefitModelPaged[~microsoft.softwareplan.models.HybridUseBenefitModel] + :raises: + :class:`ErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'planId': self._serialize.url("plan_id", plan_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.HybridUseBenefitModelPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/hybridUseBenefits/{planId}/revisions'} diff --git a/sdk/azure-mgmt/softwareplan/operations/_operations.py b/sdk/azure-mgmt/softwareplan/operations/_operations.py new file mode 100644 index 000000000000..9adafe5af7d5 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/operations/_operations.py @@ -0,0 +1,110 @@ +# 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 Operations(object): + """Operations 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: The api-version to be used by the service. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def list( + self, scope, custom_headers=None, raw=False, **operation_config): + """Get operations. + + List all the operations. + + :param scope: The scope at which the operation is performed. This is + limited to Microsoft.Compute/virtualMachines and + Microsoft.Compute/hostGroups/hosts for now + :type scope: 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: An iterator like instance of OperationResponse + :rtype: + ~microsoft.softwareplan.models.OperationResponsePaged[~microsoft.softwareplan.models.OperationResponse] + :raises: + :class:`ErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # 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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationResponsePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.SoftwarePlan/operations'} diff --git a/sdk/azure-mgmt/softwareplan/operations/_software_plan_operations.py b/sdk/azure-mgmt/softwareplan/operations/_software_plan_operations.py new file mode 100644 index 000000000000..b1546154b04f --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/operations/_software_plan_operations.py @@ -0,0 +1,85 @@ +# 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 SoftwarePlanOperations(object): + """SoftwarePlanOperations 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: The api-version to be used by the service. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def register( + self, custom_headers=None, raw=False, **operation_config): + """Register to Microsoft.SoftwarePlan resource provider. + + :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:`ErrorException` + """ + # Construct URL + url = self.register.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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 [204]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SoftwarePlan/register'} diff --git a/sdk/azure-mgmt/softwareplan/version.py b/sdk/azure-mgmt/softwareplan/version.py new file mode 100644 index 000000000000..15a0084e7417 --- /dev/null +++ b/sdk/azure-mgmt/softwareplan/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2019-06-01-preview" +