From e31b67cba71443e5214bd3f3de6d0d83ed5540fe Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sun, 30 Aug 2020 22:22:06 +0000 Subject: [PATCH] Update from release/v3 --- .../azure-mgmt-apimanagement/README.md | 2 +- .../apimanagement/_api_management_client.py | 15 + .../mgmt/apimanagement/models/__init__.py | 13 + .../models/_api_management_client_enums.py | 1 + .../mgmt/apimanagement/models/_models.py | 127 +++++- .../mgmt/apimanagement/models/_models_py3.py | 127 +++++- .../apimanagement/models/_paged_models.py | 26 ++ .../mgmt/apimanagement/operations/__init__.py | 6 + .../operations/_content_item_operations.py | 379 ++++++++++++++++++ .../operations/_content_type_operations.py | 296 ++++++++++++++ .../operations/_content_types_operations.py | 107 +++++ .../_quota_by_counter_keys_operations.py | 4 +- .../_quota_by_period_keys_operations.py | 4 +- .../operations/_subscription_operations.py | 16 +- .../_user_confirmation_password_operations.py | 8 +- .../operations/_user_operations.py | 14 +- .../azure-mgmt-apimanagement/setup.py | 4 +- 17 files changed, 1116 insertions(+), 33 deletions(-) create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py create mode 100644 sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_types_operations.py diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/README.md b/sdk/apimanagement/azure-mgmt-apimanagement/README.md index cd8514051b3a..b40d66c86a8b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/README.md +++ b/sdk/apimanagement/azure-mgmt-apimanagement/README.md @@ -2,7 +2,7 @@ This is the Microsoft Azure API Management Client Library. This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. -For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) # Usage diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py index b7ddabddd99a..322f2350dc77 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_api_management_client.py @@ -33,6 +33,9 @@ from .operations import BackendOperations from .operations import CacheOperations from .operations import CertificateOperations +from .operations import ContentTypeOperations +from .operations import ContentTypesOperations +from .operations import ContentItemOperations from .operations import ApiManagementOperations from .operations import ApiManagementServiceSkusOperations from .operations import ApiManagementServiceOperations @@ -126,6 +129,12 @@ class ApiManagementClient(SDKClient): :vartype cache: azure.mgmt.apimanagement.operations.CacheOperations :ivar certificate: Certificate operations :vartype certificate: azure.mgmt.apimanagement.operations.CertificateOperations + :ivar content_type: ContentType operations + :vartype content_type: azure.mgmt.apimanagement.operations.ContentTypeOperations + :ivar content_types: ContentTypes operations + :vartype content_types: azure.mgmt.apimanagement.operations.ContentTypesOperations + :ivar content_item: ContentItem operations + :vartype content_item: azure.mgmt.apimanagement.operations.ContentItemOperations :ivar api_management_operations: ApiManagementOperations operations :vartype api_management_operations: azure.mgmt.apimanagement.operations.ApiManagementOperations :ivar api_management_service_skus: ApiManagementServiceSkus operations @@ -276,6 +285,12 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.certificate = CertificateOperations( self._client, self.config, self._serialize, self._deserialize) + self.content_type = ContentTypeOperations( + self._client, self.config, self._serialize, self._deserialize) + self.content_types = ContentTypesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.content_item = ContentItemOperations( + self._client, self.config, self._serialize, self._deserialize) self.api_management_operations = ApiManagementOperations( self._client, self.config, self._serialize, self._deserialize) self.api_management_service_skus = ApiManagementServiceSkusOperations( diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py index 63f339e9d0f0..891271960c6e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/__init__.py @@ -65,6 +65,8 @@ from ._models_py3 import CertificateInformation from ._models_py3 import ClientSecretContract from ._models_py3 import ConnectivityStatusContract + from ._models_py3 import ContentItemContract + from ._models_py3 import ContentTypeContract from ._models_py3 import DeployConfigurationParameters from ._models_py3 import DiagnosticContract from ._models_py3 import EmailTemplateContract @@ -135,6 +137,7 @@ from ._models_py3 import QuotaCounterContract from ._models_py3 import QuotaCounterValueContract from ._models_py3 import QuotaCounterValueContractProperties + from ._models_py3 import QuotaCounterValueUpdateContract from ._models_py3 import RecipientEmailCollection from ._models_py3 import RecipientEmailContract from ._models_py3 import RecipientsContractProperties @@ -236,6 +239,8 @@ from ._models import CertificateInformation from ._models import ClientSecretContract from ._models import ConnectivityStatusContract + from ._models import ContentItemContract + from ._models import ContentTypeContract from ._models import DeployConfigurationParameters from ._models import DiagnosticContract from ._models import EmailTemplateContract @@ -306,6 +311,7 @@ from ._models import QuotaCounterContract from ._models import QuotaCounterValueContract from ._models import QuotaCounterValueContractProperties + from ._models import QuotaCounterValueUpdateContract from ._models import RecipientEmailCollection from ._models import RecipientEmailContract from ._models import RecipientsContractProperties @@ -360,6 +366,8 @@ from ._paged_models import BackendContractPaged from ._paged_models import CacheContractPaged from ._paged_models import CertificateContractPaged +from ._paged_models import ContentItemContractPaged +from ._paged_models import ContentTypeContractPaged from ._paged_models import DiagnosticContractPaged from ._paged_models import EmailTemplateContractPaged from ._paged_models import GatewayContractPaged @@ -487,6 +495,8 @@ 'CertificateInformation', 'ClientSecretContract', 'ConnectivityStatusContract', + 'ContentItemContract', + 'ContentTypeContract', 'DeployConfigurationParameters', 'DiagnosticContract', 'EmailTemplateContract', @@ -557,6 +567,7 @@ 'QuotaCounterContract', 'QuotaCounterValueContract', 'QuotaCounterValueContractProperties', + 'QuotaCounterValueUpdateContract', 'RecipientEmailCollection', 'RecipientEmailContract', 'RecipientsContractProperties', @@ -620,6 +631,8 @@ 'BackendContractPaged', 'CacheContractPaged', 'CertificateContractPaged', + 'ContentTypeContractPaged', + 'ContentItemContractPaged', 'OperationPaged', 'ResourceSkuResultPaged', 'ApiManagementServiceResourcePaged', diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py index 6c2944f5bc97..dd052c71ba3b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_api_management_client_enums.py @@ -210,6 +210,7 @@ class KeyType(str, Enum): class AppType(str, Enum): + portal = "portal" #: User create request was sent by legacy developer portal. developer_portal = "developerPortal" #: User create request was sent by new developer portal. diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models.py index 3e016257f412..d171bcd79553 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models.py @@ -3230,6 +3230,91 @@ def __init__(self, **kwargs): self.last_status_change = kwargs.get('last_status_change', None) +class ContentItemContract(Resource): + """Content type contract details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type for API Management resource. + :vartype type: str + :param properties: Properties of the content item. + :type properties: dict[str, object] + """ + + _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'}, + 'properties': {'key': 'properties', 'type': '{object}'}, + } + + def __init__(self, **kwargs): + super(ContentItemContract, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ContentTypeContract(Resource): + """Content type contract details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type for API Management resource. + :vartype type: str + :param content_type_contract_id: Content type identifier + :type content_type_contract_id: str + :param content_type_contract_name: Content type name. Must be 1 to 250 + characters long. + :type content_type_contract_name: str + :param description: Content type description. + :type description: str + :param schema: Content type schema. + :type schema: object + :param version: Content type version. + :type version: 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'}, + 'content_type_contract_id': {'key': 'properties.id', 'type': 'str'}, + 'content_type_contract_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'schema': {'key': 'properties.schema', 'type': 'object'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ContentTypeContract, self).__init__(**kwargs) + self.content_type_contract_id = kwargs.get('content_type_contract_id', None) + self.content_type_contract_name = kwargs.get('content_type_contract_name', None) + self.description = kwargs.get('description', None) + self.schema = kwargs.get('schema', None) + self.version = kwargs.get('version', None) + + class DeployConfigurationParameters(Model): """Deploy Tenant Configuration Contract. @@ -5779,12 +5864,12 @@ class ProductContract(Resource): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -5849,12 +5934,12 @@ class ProductEntityBaseParameters(Model): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -5910,12 +5995,12 @@ class ProductTagResourceContractProperties(ProductEntityBaseParameters): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -5972,12 +6057,12 @@ class ProductUpdateParameters(Model): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -6142,6 +6227,26 @@ def __init__(self, **kwargs): self.kb_transferred = kwargs.get('kb_transferred', None) +class QuotaCounterValueUpdateContract(Model): + """Quota counter value details. + + :param calls_count: Number of times Counter was called. + :type calls_count: int + :param kb_transferred: Data Transferred in KiloBytes. + :type kb_transferred: float + """ + + _attribute_map = { + 'calls_count': {'key': 'properties.callsCount', 'type': 'int'}, + 'kb_transferred': {'key': 'properties.kbTransferred', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(QuotaCounterValueUpdateContract, self).__init__(**kwargs) + self.calls_count = kwargs.get('calls_count', None) + self.kb_transferred = kwargs.get('kb_transferred', None) + + class RecipientEmailCollection(Model): """Paged Recipient User list representation. @@ -6976,7 +7081,7 @@ class SubscriptionContract(Resource): value. :type secondary_key: str :param state_comment: Optional subscription comment added by an - administrator. + administrator when the state is changed to the 'rejected'. :type state_comment: str :param allow_tracing: Determines whether tracing is enabled :type allow_tracing: bool @@ -7183,7 +7288,7 @@ class SubscriptionUpdateParameters(Model): 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled' :type state: str or ~azure.mgmt.apimanagement.models.SubscriptionState :param state_comment: Comments describing subscription state change by the - administrator. + administrator when the state is changed to the 'rejected'. :type state_comment: str :param allow_tracing: Determines whether tracing can be enabled :type allow_tracing: bool @@ -7620,7 +7725,7 @@ class UserCreateParameters(Model): password is generated. :type password: str :param app_type: Determines the type of application which send the create - user request. Default is old publisher portal. Possible values include: + user request. Default is legacy portal. Possible values include: 'portal', 'developerPortal' :type app_type: str or ~azure.mgmt.apimanagement.models.AppType :param confirmation: Determines the type of confirmation e-mail that will diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py index 1e014d4da659..49f1262fafcd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_models_py3.py @@ -3230,6 +3230,91 @@ def __init__(self, *, name: str, status, last_updated, last_status_change, error self.last_status_change = last_status_change +class ContentItemContract(Resource): + """Content type contract details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type for API Management resource. + :vartype type: str + :param properties: Properties of the content item. + :type properties: dict[str, object] + """ + + _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'}, + 'properties': {'key': 'properties', 'type': '{object}'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(ContentItemContract, self).__init__(**kwargs) + self.properties = properties + + +class ContentTypeContract(Resource): + """Content type contract details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type for API Management resource. + :vartype type: str + :param content_type_contract_id: Content type identifier + :type content_type_contract_id: str + :param content_type_contract_name: Content type name. Must be 1 to 250 + characters long. + :type content_type_contract_name: str + :param description: Content type description. + :type description: str + :param schema: Content type schema. + :type schema: object + :param version: Content type version. + :type version: 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'}, + 'content_type_contract_id': {'key': 'properties.id', 'type': 'str'}, + 'content_type_contract_name': {'key': 'properties.name', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'schema': {'key': 'properties.schema', 'type': 'object'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__(self, *, content_type_contract_id: str=None, content_type_contract_name: str=None, description: str=None, schema=None, version: str=None, **kwargs) -> None: + super(ContentTypeContract, self).__init__(**kwargs) + self.content_type_contract_id = content_type_contract_id + self.content_type_contract_name = content_type_contract_name + self.description = description + self.schema = schema + self.version = version + + class DeployConfigurationParameters(Model): """Deploy Tenant Configuration Contract. @@ -5779,12 +5864,12 @@ class ProductContract(Resource): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -5849,12 +5934,12 @@ class ProductEntityBaseParameters(Model): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -5910,12 +5995,12 @@ class ProductTagResourceContractProperties(ProductEntityBaseParameters): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -5972,12 +6057,12 @@ class ProductUpdateParameters(Model): developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type approval_required: bool :param subscriptions_limit: Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if - subscriptionRequired property is present and has a value of false. + subscriptionRequired property is present and has a value of true. :type subscriptions_limit: int :param state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are @@ -6142,6 +6227,26 @@ def __init__(self, *, calls_count: int=None, kb_transferred: float=None, **kwarg self.kb_transferred = kb_transferred +class QuotaCounterValueUpdateContract(Model): + """Quota counter value details. + + :param calls_count: Number of times Counter was called. + :type calls_count: int + :param kb_transferred: Data Transferred in KiloBytes. + :type kb_transferred: float + """ + + _attribute_map = { + 'calls_count': {'key': 'properties.callsCount', 'type': 'int'}, + 'kb_transferred': {'key': 'properties.kbTransferred', 'type': 'float'}, + } + + def __init__(self, *, calls_count: int=None, kb_transferred: float=None, **kwargs) -> None: + super(QuotaCounterValueUpdateContract, self).__init__(**kwargs) + self.calls_count = calls_count + self.kb_transferred = kb_transferred + + class RecipientEmailCollection(Model): """Paged Recipient User list representation. @@ -6976,7 +7081,7 @@ class SubscriptionContract(Resource): value. :type secondary_key: str :param state_comment: Optional subscription comment added by an - administrator. + administrator when the state is changed to the 'rejected'. :type state_comment: str :param allow_tracing: Determines whether tracing is enabled :type allow_tracing: bool @@ -7183,7 +7288,7 @@ class SubscriptionUpdateParameters(Model): 'suspended', 'active', 'expired', 'submitted', 'rejected', 'cancelled' :type state: str or ~azure.mgmt.apimanagement.models.SubscriptionState :param state_comment: Comments describing subscription state change by the - administrator. + administrator when the state is changed to the 'rejected'. :type state_comment: str :param allow_tracing: Determines whether tracing can be enabled :type allow_tracing: bool @@ -7620,7 +7725,7 @@ class UserCreateParameters(Model): password is generated. :type password: str :param app_type: Determines the type of application which send the create - user request. Default is old publisher portal. Possible values include: + user request. Default is legacy portal. Possible values include: 'portal', 'developerPortal' :type app_type: str or ~azure.mgmt.apimanagement.models.AppType :param confirmation: Determines the type of confirmation e-mail that will diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_paged_models.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_paged_models.py index bc1ee244cc6c..9ec1456390f9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_paged_models.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/models/_paged_models.py @@ -246,6 +246,32 @@ class CertificateContractPaged(Paged): def __init__(self, *args, **kwargs): super(CertificateContractPaged, self).__init__(*args, **kwargs) +class ContentTypeContractPaged(Paged): + """ + A paging container for iterating over a list of :class:`ContentTypeContract ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ContentTypeContract]'} + } + + def __init__(self, *args, **kwargs): + + super(ContentTypeContractPaged, self).__init__(*args, **kwargs) +class ContentItemContractPaged(Paged): + """ + A paging container for iterating over a list of :class:`ContentItemContract ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ContentItemContract]'} + } + + def __init__(self, *args, **kwargs): + + super(ContentItemContractPaged, self).__init__(*args, **kwargs) class OperationPaged(Paged): """ A paging container for iterating over a list of :class:`Operation ` object diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py index 2dae331a8203..9e0d7dfaf34f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/__init__.py @@ -29,6 +29,9 @@ from ._backend_operations import BackendOperations from ._cache_operations import CacheOperations from ._certificate_operations import CertificateOperations +from ._content_type_operations import ContentTypeOperations +from ._content_types_operations import ContentTypesOperations +from ._content_item_operations import ContentItemOperations from ._api_management_operations import ApiManagementOperations from ._api_management_service_skus_operations import ApiManagementServiceSkusOperations from ._api_management_service_operations import ApiManagementServiceOperations @@ -95,6 +98,9 @@ 'BackendOperations', 'CacheOperations', 'CertificateOperations', + 'ContentTypeOperations', + 'ContentTypesOperations', + 'ContentItemOperations', 'ApiManagementOperations', 'ApiManagementServiceSkusOperations', 'ApiManagementServiceOperations', diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py new file mode 100644 index 000000000000..e77e53c3312d --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_item_operations.py @@ -0,0 +1,379 @@ +# 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 ContentItemOperations(object): + """ContentItemOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2019-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01" + + self.config = config + + def list_by_service( + self, resource_group_name, service_name, content_type_id, custom_headers=None, raw=False, **operation_config): + """Returns list of content items. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_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 ContentItemContract + :rtype: + ~azure.mgmt.apimanagement.models.ContentItemContractPaged[~azure.mgmt.apimanagement.models.ContentItemContract] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_service.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ContentItemContractPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems'} + + def get_entity_tag( + self, resource_group_name, service_name, content_type_id, content_item_id, custom_headers=None, raw=False, **operation_config): + """Returns content item metadata. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_id: str + :param content_item_id: Content item identifier. + :type content_item_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:`ErrorResponseException` + """ + # Construct URL + url = self.get_entity_tag.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'contentItemId': self._serialize.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.head(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) + client_raw_response.add_headers({ + 'ETag': 'str', + }) + return client_raw_response + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} + + def get( + self, resource_group_name, service_name, content_type_id, content_item_id, custom_headers=None, raw=False, **operation_config): + """Returns content item details. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_id: str + :param content_item_id: Content item identifier. + :type content_item_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: ContentItemContract or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'contentItemId': self._serialize.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContentItemContract', response) + header_dict = { + 'ETag': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} + + def create_or_update( + self, resource_group_name, service_name, content_type_id, content_item_id, custom_headers=None, raw=False, **operation_config): + """Creates new content item. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_id: str + :param content_item_id: Content item identifier. + :type content_item_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: ContentItemContract or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.apimanagement.models.ContentItemContract or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'contentItemId': self._serialize.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContentItemContract', response) + header_dict = { + 'ETag': 'str', + } + if response.status_code == 201: + deserialized = self._deserialize('ContentItemContract', response) + header_dict = { + 'ETag': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} + + def delete( + self, resource_group_name, service_name, content_type_id, content_item_id, custom_headers=None, raw=False, **operation_config): + """Removes specified content item. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_id: str + :param content_item_id: Content item identifier. + :type content_item_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:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'contentItemId': self._serialize.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py new file mode 100644 index 000000000000..d124e5666cc6 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_type_operations.py @@ -0,0 +1,296 @@ +# 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 ContentTypeOperations(object): + """ContentTypeOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2019-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01" + + self.config = config + + def list_by_service( + self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + """Returns list of content types. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_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: An iterator like instance of ContentTypeContract + :rtype: + ~azure.mgmt.apimanagement.models.ContentTypeContractPaged[~azure.mgmt.apimanagement.models.ContentTypeContract] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_service.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ContentTypeContractPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes'} + + def get_entity_tag( + self, resource_group_name, service_name, content_type_id, custom_headers=None, raw=False, **operation_config): + """Returns content type metadata. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_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:`ErrorResponseException` + """ + # Construct URL + url = self.get_entity_tag.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.head(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) + client_raw_response.add_headers({ + 'ETag': 'str', + }) + return client_raw_response + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} + + def create_or_update( + self, resource_group_name, service_name, content_type_id, custom_headers=None, raw=False, **operation_config): + """Creates new content type. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_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: ContentTypeContract or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContentTypeContract', response) + header_dict = { + 'ETag': 'str', + } + if response.status_code == 201: + deserialized = self._deserialize('ContentTypeContract', response) + header_dict = { + 'ETag': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} + + def delete( + self, resource_group_name, service_name, content_type_id, custom_headers=None, raw=False, **operation_config): + """Removes specified content type. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_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:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_types_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_types_operations.py new file mode 100644 index 000000000000..08fb2a7cdb29 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_content_types_operations.py @@ -0,0 +1,107 @@ +# 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 ContentTypesOperations(object): + """ContentTypesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Constant value: "2019-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-12-01" + + self.config = config + + def get( + self, resource_group_name, service_name, content_type_id, custom_headers=None, raw=False, **operation_config): + """Gets API Management content type details. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param service_name: The name of the API Management service. + :type service_name: str + :param content_type_id: Content type identifier. + :type content_type_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: ContentTypeContract or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.apimanagement.models.ContentTypeContract or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str', max_length=50, min_length=1, pattern=r'^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'), + 'contentTypeId': self._serialize.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ContentTypeContract', response) + header_dict = { + 'ETag': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py index 0d4220b0cfd6..4b7b87dac019 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_counter_keys_operations.py @@ -139,7 +139,7 @@ def update( :raises: :class:`ErrorResponseException` """ - parameters = models.QuotaCounterValueContractProperties(calls_count=calls_count, kb_transferred=kb_transferred) + parameters = models.QuotaCounterValueUpdateContract(calls_count=calls_count, kb_transferred=kb_transferred) # Construct URL url = self.update.metadata['url'] @@ -166,7 +166,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'QuotaCounterValueContractProperties') + body_content = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py index db29c87e0c04..e10229eb6993 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_quota_by_period_keys_operations.py @@ -142,7 +142,7 @@ def update( :raises: :class:`ErrorResponseException` """ - parameters = models.QuotaCounterValueContractProperties(calls_count=calls_count, kb_transferred=kb_transferred) + parameters = models.QuotaCounterValueUpdateContract(calls_count=calls_count, kb_transferred=kb_transferred) # Construct URL url = self.update.metadata['url'] @@ -170,7 +170,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'QuotaCounterValueContractProperties') + body_content = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py index c6dbaa892536..617ffe42b0f2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_subscription_operations.py @@ -265,7 +265,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} def create_or_update( - self, resource_group_name, service_name, sid, parameters, notify=None, if_match=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, service_name, sid, parameters, notify=None, if_match=None, app_type="portal", custom_headers=None, raw=False, **operation_config): """Creates or updates the subscription of specified user to the specified product. @@ -287,6 +287,10 @@ def create_or_update( :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. :type if_match: str + :param app_type: Determines the type of application which send the + create user request. Default is legacy publisher portal. Possible + values include: 'portal', 'developerPortal' + :type app_type: str or ~azure.mgmt.apimanagement.models.AppType :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -313,6 +317,8 @@ def create_or_update( if notify is not None: query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if app_type is not None: + query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') # Construct headers header_parameters = {} @@ -359,7 +365,7 @@ def create_or_update( create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} def update( - self, resource_group_name, service_name, sid, parameters, if_match, notify=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, service_name, sid, parameters, if_match, notify=None, app_type="portal", custom_headers=None, raw=False, **operation_config): """Updates the details of a subscription specified by its identifier. :param resource_group_name: The name of the resource group. @@ -381,6 +387,10 @@ def update( subscription - If true, send email notification of change of state of subscription :type notify: bool + :param app_type: Determines the type of application which send the + create user request. Default is legacy publisher portal. Possible + values include: 'portal', 'developerPortal' + :type app_type: str or ~azure.mgmt.apimanagement.models.AppType :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -406,6 +416,8 @@ def update( if notify is not None: query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if app_type is not None: + query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') # Construct headers header_parameters = {} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py index 193c9b412fe3..329336c87ae0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_confirmation_password_operations.py @@ -39,7 +39,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def send( - self, resource_group_name, service_name, user_id, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, service_name, user_id, app_type="portal", custom_headers=None, raw=False, **operation_config): """Sends confirmation. :param resource_group_name: The name of the resource group. @@ -49,6 +49,10 @@ def send( :param user_id: User identifier. Must be unique in the current API Management service instance. :type user_id: str + :param app_type: Determines the type of application which send the + create user request. Default is legacy publisher portal. Possible + values include: 'portal', 'developerPortal' + :type app_type: str or ~azure.mgmt.apimanagement.models.AppType :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -72,6 +76,8 @@ def send( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if app_type is not None: + query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') # Construct headers header_parameters = {} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py index 2fd37c3c6203..0f7a77beb5e1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_operations.py @@ -268,7 +268,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} def create_or_update( - self, resource_group_name, service_name, user_id, parameters, if_match=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, service_name, user_id, parameters, notify=None, if_match=None, custom_headers=None, raw=False, **operation_config): """Creates or Updates a user. :param resource_group_name: The name of the resource group. @@ -281,6 +281,8 @@ def create_or_update( :param parameters: Create or update parameters. :type parameters: ~azure.mgmt.apimanagement.models.UserCreateParameters + :param notify: Send an Email notification to the User. + :type notify: bool :param if_match: ETag of the Entity. Not required when creating an entity, but required when updating an entity. :type if_match: str @@ -307,6 +309,8 @@ def create_or_update( # Construct parameters query_parameters = {} + if notify is not None: + query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers @@ -422,7 +426,7 @@ def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} def delete( - self, resource_group_name, service_name, user_id, if_match, delete_subscriptions=None, notify=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, service_name, user_id, if_match, delete_subscriptions=None, notify=None, app_type="portal", custom_headers=None, raw=False, **operation_config): """Deletes specific user. :param resource_group_name: The name of the resource group. @@ -441,6 +445,10 @@ def delete( :type delete_subscriptions: bool :param notify: Send an Account Closed Email notification to the User. :type notify: bool + :param app_type: Determines the type of application which send the + create user request. Default is legacy publisher portal. Possible + values include: 'portal', 'developerPortal' + :type app_type: str or ~azure.mgmt.apimanagement.models.AppType :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -468,6 +476,8 @@ def delete( if notify is not None: query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if app_type is not None: + query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') # Construct headers header_parameters = {} diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/setup.py b/sdk/apimanagement/azure-mgmt-apimanagement/setup.py index 071df946dd93..a6a7586a2742 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/setup.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)