diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json index 99dfb3d4d5d7..765f28d6360a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json +++ b/sdk/apimanagement/azure-mgmt-apimanagement/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "ecf0d999c9128ddfc1cac5ba52f57a5b00f94000", + "commit": "925e8285703ddd461588d8f5fbf14bd97c286fab", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/apimanagement/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/apimanagement/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/apimanagement/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py index 2bdfd1fb9851..80f492a921b4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ApiManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() 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 e8a9118accf7..1fac9d9df29f 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 @@ -6,95 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ApiManagementClientConfiguration +from .operations import ApiDiagnosticOperations, ApiExportOperations, ApiIssueAttachmentOperations, ApiIssueCommentOperations, ApiIssueOperations, ApiManagementClientOperationsMixin, ApiManagementOperationsOperations, ApiManagementServiceOperations, ApiManagementServiceSkusOperations, ApiManagementSkusOperations, ApiOperationOperations, ApiOperationPolicyOperations, ApiOperations, ApiPolicyOperations, ApiProductOperations, ApiReleaseOperations, ApiRevisionOperations, ApiSchemaOperations, ApiTagDescriptionOperations, ApiVersionSetOperations, AuthorizationServerOperations, BackendOperations, CacheOperations, CertificateOperations, ContentItemOperations, ContentTypeOperations, DelegationSettingsOperations, DeletedServicesOperations, DiagnosticOperations, EmailTemplateOperations, GatewayApiOperations, GatewayCertificateAuthorityOperations, GatewayHostnameConfigurationOperations, GatewayOperations, GlobalSchemaOperations, GroupOperations, GroupUserOperations, IdentityProviderOperations, IssueOperations, LoggerOperations, NamedValueOperations, NetworkStatusOperations, NotificationOperations, NotificationRecipientEmailOperations, NotificationRecipientUserOperations, OpenIdConnectProviderOperations, OperationOperations, OutboundNetworkDependenciesEndpointsOperations, PolicyDescriptionOperations, PolicyOperations, PortalRevisionOperations, PortalSettingsOperations, PrivateEndpointConnectionOperations, ProductApiOperations, ProductGroupOperations, ProductOperations, ProductPolicyOperations, ProductSubscriptionsOperations, QuotaByCounterKeysOperations, QuotaByPeriodKeysOperations, RegionOperations, ReportsOperations, SignInSettingsOperations, SignUpSettingsOperations, SubscriptionOperations, TagOperations, TagResourceOperations, TenantAccessGitOperations, TenantAccessOperations, TenantConfigurationOperations, TenantSettingsOperations, UserConfirmationPasswordOperations, UserGroupOperations, UserIdentitiesOperations, UserOperations, UserSubscriptionOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ApiManagementClientConfiguration -from .operations import ApiOperations -from .operations import ApiRevisionOperations -from .operations import ApiReleaseOperations -from .operations import ApiOperationOperations -from .operations import ApiOperationPolicyOperations -from .operations import TagOperations -from .operations import ApiProductOperations -from .operations import ApiPolicyOperations -from .operations import ApiSchemaOperations -from .operations import ApiDiagnosticOperations -from .operations import ApiIssueOperations -from .operations import ApiIssueCommentOperations -from .operations import ApiIssueAttachmentOperations -from .operations import ApiTagDescriptionOperations -from .operations import OperationOperations -from .operations import ApiExportOperations -from .operations import ApiVersionSetOperations -from .operations import AuthorizationServerOperations -from .operations import BackendOperations -from .operations import CacheOperations -from .operations import CertificateOperations -from .operations import ContentTypeOperations -from .operations import ContentItemOperations -from .operations import DeletedServicesOperations -from .operations import ApiManagementOperationsOperations -from .operations import ApiManagementServiceSkusOperations -from .operations import ApiManagementServiceOperations -from .operations import DiagnosticOperations -from .operations import EmailTemplateOperations -from .operations import GatewayOperations -from .operations import GatewayHostnameConfigurationOperations -from .operations import GatewayApiOperations -from .operations import GatewayCertificateAuthorityOperations -from .operations import GroupOperations -from .operations import GroupUserOperations -from .operations import IdentityProviderOperations -from .operations import IssueOperations -from .operations import LoggerOperations -from .operations import NamedValueOperations -from .operations import NetworkStatusOperations -from .operations import NotificationOperations -from .operations import NotificationRecipientUserOperations -from .operations import NotificationRecipientEmailOperations -from .operations import OpenIdConnectProviderOperations -from .operations import PolicyOperations -from .operations import PolicyDescriptionOperations -from .operations import PortalRevisionOperations -from .operations import PortalSettingsOperations -from .operations import SignInSettingsOperations -from .operations import SignUpSettingsOperations -from .operations import DelegationSettingsOperations -from .operations import ProductOperations -from .operations import ProductApiOperations -from .operations import ProductGroupOperations -from .operations import ProductSubscriptionsOperations -from .operations import ProductPolicyOperations -from .operations import QuotaByCounterKeysOperations -from .operations import QuotaByPeriodKeysOperations -from .operations import RegionOperations -from .operations import ReportsOperations -from .operations import TenantSettingsOperations -from .operations import ApiManagementSkusOperations -from .operations import SubscriptionOperations -from .operations import TagResourceOperations -from .operations import TenantAccessOperations -from .operations import TenantAccessGitOperations -from .operations import TenantConfigurationOperations -from .operations import UserOperations -from .operations import UserGroupOperations -from .operations import UserSubscriptionOperations -from .operations import UserIdentitiesOperations -from .operations import UserConfirmationPasswordOperations -from . import models + from azure.core.rest import HttpRequest, HttpResponse - -class ApiManagementClient(object): +class ApiManagementClient(ApiManagementClientOperationsMixin): """ApiManagement Client. :ivar api: ApiOperations operations @@ -132,7 +61,8 @@ class ApiManagementClient(object): :ivar api_version_set: ApiVersionSetOperations operations :vartype api_version_set: azure.mgmt.apimanagement.operations.ApiVersionSetOperations :ivar authorization_server: AuthorizationServerOperations operations - :vartype authorization_server: azure.mgmt.apimanagement.operations.AuthorizationServerOperations + :vartype authorization_server: + azure.mgmt.apimanagement.operations.AuthorizationServerOperations :ivar backend: BackendOperations operations :vartype backend: azure.mgmt.apimanagement.operations.BackendOperations :ivar cache: CacheOperations operations @@ -146,11 +76,14 @@ class ApiManagementClient(object): :ivar deleted_services: DeletedServicesOperations operations :vartype deleted_services: azure.mgmt.apimanagement.operations.DeletedServicesOperations :ivar api_management_operations: ApiManagementOperationsOperations operations - :vartype api_management_operations: azure.mgmt.apimanagement.operations.ApiManagementOperationsOperations + :vartype api_management_operations: + azure.mgmt.apimanagement.operations.ApiManagementOperationsOperations :ivar api_management_service_skus: ApiManagementServiceSkusOperations operations - :vartype api_management_service_skus: azure.mgmt.apimanagement.operations.ApiManagementServiceSkusOperations + :vartype api_management_service_skus: + azure.mgmt.apimanagement.operations.ApiManagementServiceSkusOperations :ivar api_management_service: ApiManagementServiceOperations operations - :vartype api_management_service: azure.mgmt.apimanagement.operations.ApiManagementServiceOperations + :vartype api_management_service: + azure.mgmt.apimanagement.operations.ApiManagementServiceOperations :ivar diagnostic: DiagnosticOperations operations :vartype diagnostic: azure.mgmt.apimanagement.operations.DiagnosticOperations :ivar email_template: EmailTemplateOperations operations @@ -158,11 +91,13 @@ class ApiManagementClient(object): :ivar gateway: GatewayOperations operations :vartype gateway: azure.mgmt.apimanagement.operations.GatewayOperations :ivar gateway_hostname_configuration: GatewayHostnameConfigurationOperations operations - :vartype gateway_hostname_configuration: azure.mgmt.apimanagement.operations.GatewayHostnameConfigurationOperations + :vartype gateway_hostname_configuration: + azure.mgmt.apimanagement.operations.GatewayHostnameConfigurationOperations :ivar gateway_api: GatewayApiOperations operations :vartype gateway_api: azure.mgmt.apimanagement.operations.GatewayApiOperations :ivar gateway_certificate_authority: GatewayCertificateAuthorityOperations operations - :vartype gateway_certificate_authority: azure.mgmt.apimanagement.operations.GatewayCertificateAuthorityOperations + :vartype gateway_certificate_authority: + azure.mgmt.apimanagement.operations.GatewayCertificateAuthorityOperations :ivar group: GroupOperations operations :vartype group: azure.mgmt.apimanagement.operations.GroupOperations :ivar group_user: GroupUserOperations operations @@ -180,11 +115,18 @@ class ApiManagementClient(object): :ivar notification: NotificationOperations operations :vartype notification: azure.mgmt.apimanagement.operations.NotificationOperations :ivar notification_recipient_user: NotificationRecipientUserOperations operations - :vartype notification_recipient_user: azure.mgmt.apimanagement.operations.NotificationRecipientUserOperations + :vartype notification_recipient_user: + azure.mgmt.apimanagement.operations.NotificationRecipientUserOperations :ivar notification_recipient_email: NotificationRecipientEmailOperations operations - :vartype notification_recipient_email: azure.mgmt.apimanagement.operations.NotificationRecipientEmailOperations + :vartype notification_recipient_email: + azure.mgmt.apimanagement.operations.NotificationRecipientEmailOperations :ivar open_id_connect_provider: OpenIdConnectProviderOperations operations - :vartype open_id_connect_provider: azure.mgmt.apimanagement.operations.OpenIdConnectProviderOperations + :vartype open_id_connect_provider: + azure.mgmt.apimanagement.operations.OpenIdConnectProviderOperations + :ivar outbound_network_dependencies_endpoints: OutboundNetworkDependenciesEndpointsOperations + operations + :vartype outbound_network_dependencies_endpoints: + azure.mgmt.apimanagement.operations.OutboundNetworkDependenciesEndpointsOperations :ivar policy: PolicyOperations operations :vartype policy: azure.mgmt.apimanagement.operations.PolicyOperations :ivar policy_description: PolicyDescriptionOperations operations @@ -199,6 +141,9 @@ class ApiManagementClient(object): :vartype sign_up_settings: azure.mgmt.apimanagement.operations.SignUpSettingsOperations :ivar delegation_settings: DelegationSettingsOperations operations :vartype delegation_settings: azure.mgmt.apimanagement.operations.DelegationSettingsOperations + :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations + :vartype private_endpoint_connection: + azure.mgmt.apimanagement.operations.PrivateEndpointConnectionOperations :ivar product: ProductOperations operations :vartype product: azure.mgmt.apimanagement.operations.ProductOperations :ivar product_api: ProductApiOperations operations @@ -206,17 +151,21 @@ class ApiManagementClient(object): :ivar product_group: ProductGroupOperations operations :vartype product_group: azure.mgmt.apimanagement.operations.ProductGroupOperations :ivar product_subscriptions: ProductSubscriptionsOperations operations - :vartype product_subscriptions: azure.mgmt.apimanagement.operations.ProductSubscriptionsOperations + :vartype product_subscriptions: + azure.mgmt.apimanagement.operations.ProductSubscriptionsOperations :ivar product_policy: ProductPolicyOperations operations :vartype product_policy: azure.mgmt.apimanagement.operations.ProductPolicyOperations :ivar quota_by_counter_keys: QuotaByCounterKeysOperations operations - :vartype quota_by_counter_keys: azure.mgmt.apimanagement.operations.QuotaByCounterKeysOperations + :vartype quota_by_counter_keys: + azure.mgmt.apimanagement.operations.QuotaByCounterKeysOperations :ivar quota_by_period_keys: QuotaByPeriodKeysOperations operations :vartype quota_by_period_keys: azure.mgmt.apimanagement.operations.QuotaByPeriodKeysOperations :ivar region: RegionOperations operations :vartype region: azure.mgmt.apimanagement.operations.RegionOperations :ivar reports: ReportsOperations operations :vartype reports: azure.mgmt.apimanagement.operations.ReportsOperations + :ivar global_schema: GlobalSchemaOperations operations + :vartype global_schema: azure.mgmt.apimanagement.operations.GlobalSchemaOperations :ivar tenant_settings: TenantSettingsOperations operations :vartype tenant_settings: azure.mgmt.apimanagement.operations.TenantSettingsOperations :ivar api_management_skus: ApiManagementSkusOperations operations @@ -230,7 +179,8 @@ class ApiManagementClient(object): :ivar tenant_access_git: TenantAccessGitOperations operations :vartype tenant_access_git: azure.mgmt.apimanagement.operations.TenantAccessGitOperations :ivar tenant_configuration: TenantConfigurationOperations operations - :vartype tenant_configuration: azure.mgmt.apimanagement.operations.TenantConfigurationOperations + :vartype tenant_configuration: + azure.mgmt.apimanagement.operations.TenantConfigurationOperations :ivar user: UserOperations operations :vartype user: azure.mgmt.apimanagement.operations.UserOperations :ivar user_group: UserGroupOperations operations @@ -240,195 +190,137 @@ class ApiManagementClient(object): :ivar user_identities: UserIdentitiesOperations operations :vartype user_identities: azure.mgmt.apimanagement.operations.UserIdentitiesOperations :ivar user_confirmation_password: UserConfirmationPasswordOperations operations - :vartype user_confirmation_password: azure.mgmt.apimanagement.operations.UserConfirmationPasswordOperations + :vartype user_confirmation_password: + azure.mgmt.apimanagement.operations.UserConfirmationPasswordOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ApiManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ApiManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.api = ApiOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_revision = ApiRevisionOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_release = ApiReleaseOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_operation = ApiOperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_operation_policy = ApiOperationPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.tag = TagOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_product = ApiProductOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_policy = ApiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_schema = ApiSchemaOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_diagnostic = ApiDiagnosticOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_issue = ApiIssueOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_issue_comment = ApiIssueCommentOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_issue_attachment = ApiIssueAttachmentOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_tag_description = ApiTagDescriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_export = ApiExportOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_set = ApiVersionSetOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorization_server = AuthorizationServerOperations(self._client, self._config, self._serialize, self._deserialize) + self.backend = BackendOperations(self._client, self._config, self._serialize, self._deserialize) + self.cache = CacheOperations(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_item = ContentItemOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_services = DeletedServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_operations = ApiManagementOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_service_skus = ApiManagementServiceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_service = ApiManagementServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.diagnostic = DiagnosticOperations(self._client, self._config, self._serialize, self._deserialize) + self.email_template = EmailTemplateOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway = GatewayOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_api = GatewayApiOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_certificate_authority = GatewayCertificateAuthorityOperations(self._client, self._config, self._serialize, self._deserialize) + self.group = GroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.group_user = GroupUserOperations(self._client, self._config, self._serialize, self._deserialize) + self.identity_provider = IdentityProviderOperations(self._client, self._config, self._serialize, self._deserialize) + self.issue = IssueOperations(self._client, self._config, self._serialize, self._deserialize) + self.logger = LoggerOperations(self._client, self._config, self._serialize, self._deserialize) + self.named_value = NamedValueOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_status = NetworkStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification = NotificationOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification_recipient_user = NotificationRecipientUserOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification_recipient_email = NotificationRecipientEmailOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_id_connect_provider = OpenIdConnectProviderOperations(self._client, self._config, self._serialize, self._deserialize) + self.outbound_network_dependencies_endpoints = OutboundNetworkDependenciesEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.policy = PolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.policy_description = PolicyDescriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.portal_revision = PortalRevisionOperations(self._client, self._config, self._serialize, self._deserialize) + self.portal_settings = PortalSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sign_in_settings = SignInSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sign_up_settings = SignUpSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.delegation_settings = DelegationSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connection = PrivateEndpointConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.product = ProductOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_api = ProductApiOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_group = ProductGroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_subscriptions = ProductSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_policy = ProductPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota_by_counter_keys = QuotaByCounterKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota_by_period_keys = QuotaByPeriodKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.region = RegionOperations(self._client, self._config, self._serialize, self._deserialize) + self.reports = ReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.global_schema = GlobalSchemaOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_settings = TenantSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_skus = ApiManagementSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription = SubscriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.tag_resource = TagResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_access = TenantAccessOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_access_git = TenantAccessGitOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_configuration = TenantConfigurationOperations(self._client, self._config, self._serialize, self._deserialize) + self.user = UserOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_group = UserGroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_subscription = UserSubscriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_identities = UserIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_confirmation_password = UserConfirmationPasswordOperations(self._client, self._config, self._serialize, self._deserialize) - self.api = ApiOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_revision = ApiRevisionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_release = ApiReleaseOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_operation = ApiOperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_operation_policy = ApiOperationPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag = TagOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_product = ApiProductOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_policy = ApiPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_schema = ApiSchemaOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_diagnostic = ApiDiagnosticOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_issue = ApiIssueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_issue_comment = ApiIssueCommentOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_issue_attachment = ApiIssueAttachmentOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_tag_description = ApiTagDescriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_export = ApiExportOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_version_set = ApiVersionSetOperations( - self._client, self._config, self._serialize, self._deserialize) - self.authorization_server = AuthorizationServerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backend = BackendOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cache = CacheOperations( - 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_item = ContentItemOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_services = DeletedServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_operations = ApiManagementOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_service_skus = ApiManagementServiceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_service = ApiManagementServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.diagnostic = DiagnosticOperations( - self._client, self._config, self._serialize, self._deserialize) - self.email_template = EmailTemplateOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway = GatewayOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_api = GatewayApiOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_certificate_authority = GatewayCertificateAuthorityOperations( - self._client, self._config, self._serialize, self._deserialize) - self.group = GroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.group_user = GroupUserOperations( - self._client, self._config, self._serialize, self._deserialize) - self.identity_provider = IdentityProviderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.issue = IssueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.logger = LoggerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.named_value = NamedValueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_status = NetworkStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification = NotificationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification_recipient_user = NotificationRecipientUserOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification_recipient_email = NotificationRecipientEmailOperations( - self._client, self._config, self._serialize, self._deserialize) - self.open_id_connect_provider = OpenIdConnectProviderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.policy = PolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.policy_description = PolicyDescriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.portal_revision = PortalRevisionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.portal_settings = PortalSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sign_in_settings = SignInSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sign_up_settings = SignUpSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.delegation_settings = DelegationSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product = ProductOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_api = ProductApiOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_group = ProductGroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_subscriptions = ProductSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_policy = ProductPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota_by_counter_keys = QuotaByCounterKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota_by_period_keys = QuotaByPeriodKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.region = RegionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.reports = ReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_settings = TenantSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_skus = ApiManagementSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.subscription = SubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_resource = TagResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_access = TenantAccessOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_access_git = TenantAccessGitOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_configuration = TenantConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user = UserOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_group = UserGroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_subscription = UserSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_identities = UserIdentitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_confirmation_password = UserConfirmationPasswordOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py index 38989b8ec5c4..6c9bf4a4c65b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,15 +40,15 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(ApiManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ApiManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-12-01" + self.api_version = "2021-08-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-apimanagement/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_metadata.json b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_metadata.json index 1e090b9998aa..9e09698b6a8f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_metadata.json +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2020-12-01", - "total_api_version_list": ["2020-12-01"], + "chosen_version": "2021-08-01", + "total_api_version_list": ["2021-08-01"], "client": { "name": "ApiManagementClient", "filename": "_api_management_client", "description": "ApiManagement Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ApiManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ApiManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ApiManagementClientConfiguration\"], \"._operations_mixin\": [\"ApiManagementClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ApiManagementClientConfiguration\"], \"._operations_mixin\": [\"ApiManagementClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "api": "ApiOperations", @@ -142,6 +141,7 @@ "notification_recipient_user": "NotificationRecipientUserOperations", "notification_recipient_email": "NotificationRecipientEmailOperations", "open_id_connect_provider": "OpenIdConnectProviderOperations", + "outbound_network_dependencies_endpoints": "OutboundNetworkDependenciesEndpointsOperations", "policy": "PolicyOperations", "policy_description": "PolicyDescriptionOperations", "portal_revision": "PortalRevisionOperations", @@ -149,6 +149,7 @@ "sign_in_settings": "SignInSettingsOperations", "sign_up_settings": "SignUpSettingsOperations", "delegation_settings": "DelegationSettingsOperations", + "private_endpoint_connection": "PrivateEndpointConnectionOperations", "product": "ProductOperations", "product_api": "ProductApiOperations", "product_group": "ProductGroupOperations", @@ -158,6 +159,7 @@ "quota_by_period_keys": "QuotaByPeriodKeysOperations", "region": "RegionOperations", "reports": "ReportsOperations", + "global_schema": "GlobalSchemaOperations", "tenant_settings": "TenantSettingsOperations", "api_management_skus": "ApiManagementSkusOperations", "subscription": "SubscriptionOperations", @@ -170,5 +172,35 @@ "user_subscription": "UserSubscriptionOperations", "user_identities": "UserIdentitiesOperations", "user_confirmation_password": "UserConfirmationPasswordOperations" + }, + "operation_mixins": { + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.polling\": [\"LROPoller\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.polling\": [\"AsyncLROPoller\"]}}}", + "operations": { + "_perform_connectivity_check_async_initial" : { + "sync": { + "signature": "def _perform_connectivity_check_async_initial(\n self,\n resource_group_name, # type: str\n service_name, # type: str\n connectivity_check_request_params, # type: \"_models.ConnectivityCheckRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[\"_models.ConnectivityCheckResponse\"]\n", + "doc": "\n\n:param resource_group_name: The name of the resource group.\n:type resource_group_name: str\n:param service_name: The name of the API Management service.\n:type service_name: str\n:param connectivity_check_request_params: Connectivity Check request parameters.\n:type connectivity_check_request_params:\n ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ConnectivityCheckResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.apimanagement.models.ConnectivityCheckResponse or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _perform_connectivity_check_async_initial(\n self,\n resource_group_name: str,\n service_name: str,\n connectivity_check_request_params: \"_models.ConnectivityCheckRequest\",\n **kwargs: Any\n) -\u003e Optional[\"_models.ConnectivityCheckResponse\"]:\n", + "doc": "\n\n:param resource_group_name: The name of the resource group.\n:type resource_group_name: str\n:param service_name: The name of the API Management service.\n:type service_name: str\n:param connectivity_check_request_params: Connectivity Check request parameters.\n:type connectivity_check_request_params:\n ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ConnectivityCheckResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.apimanagement.models.ConnectivityCheckResponse or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, service_name, connectivity_check_request_params" + }, + "begin_perform_connectivity_check_async" : { + "sync": { + "signature": "def begin_perform_connectivity_check_async(\n self,\n resource_group_name, # type: str\n service_name, # type: str\n connectivity_check_request_params, # type: \"_models.ConnectivityCheckRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[\"_models.ConnectivityCheckResponse\"]\n", + "doc": "\"\"\"Performs a connectivity check between the API Management service and a given destination, and\nreturns metrics for the connection, as well as errors encountered while trying to establish it.\n\n:param resource_group_name: The name of the resource group.\n:type resource_group_name: str\n:param service_name: The name of the API Management service.\n:type service_name: str\n:param connectivity_check_request_params: Connectivity Check request parameters.\n:type connectivity_check_request_params:\n ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either ConnectivityCheckResponse or the result\n of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ConnectivityCheckResponse]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_perform_connectivity_check_async(\n self,\n resource_group_name: str,\n service_name: str,\n connectivity_check_request_params: \"_models.ConnectivityCheckRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[\"_models.ConnectivityCheckResponse\"]:\n", + "doc": "\"\"\"Performs a connectivity check between the API Management service and a given destination, and\nreturns metrics for the connection, as well as errors encountered while trying to establish it.\n\n:param resource_group_name: The name of the resource group.\n:type resource_group_name: str\n:param service_name: The name of the API Management service.\n:type service_name: str\n:param connectivity_check_request_params: Connectivity Check request parameters.\n:type connectivity_check_request_params:\n ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either ConnectivityCheckResponse or the\n result of cls(response)\n:rtype:\n ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ConnectivityCheckResponse]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "resource_group_name, service_name, connectivity_check_request_params" + } + } } } \ No newline at end of file diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py index 83f24ab50946..eae7c95b6fbd 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0" +VERSION = "0.1.0" diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py index 8ef78e4dcbb0..bed0fab90ba8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/__init__.py @@ -8,3 +8,8 @@ from ._api_management_client import ApiManagementClient __all__ = ['ApiManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py index 3c2ffc6bfec3..790bc9e17c2b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_api_management_client.py @@ -6,93 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ApiManagementClientConfiguration +from .operations import ApiDiagnosticOperations, ApiExportOperations, ApiIssueAttachmentOperations, ApiIssueCommentOperations, ApiIssueOperations, ApiManagementClientOperationsMixin, ApiManagementOperationsOperations, ApiManagementServiceOperations, ApiManagementServiceSkusOperations, ApiManagementSkusOperations, ApiOperationOperations, ApiOperationPolicyOperations, ApiOperations, ApiPolicyOperations, ApiProductOperations, ApiReleaseOperations, ApiRevisionOperations, ApiSchemaOperations, ApiTagDescriptionOperations, ApiVersionSetOperations, AuthorizationServerOperations, BackendOperations, CacheOperations, CertificateOperations, ContentItemOperations, ContentTypeOperations, DelegationSettingsOperations, DeletedServicesOperations, DiagnosticOperations, EmailTemplateOperations, GatewayApiOperations, GatewayCertificateAuthorityOperations, GatewayHostnameConfigurationOperations, GatewayOperations, GlobalSchemaOperations, GroupOperations, GroupUserOperations, IdentityProviderOperations, IssueOperations, LoggerOperations, NamedValueOperations, NetworkStatusOperations, NotificationOperations, NotificationRecipientEmailOperations, NotificationRecipientUserOperations, OpenIdConnectProviderOperations, OperationOperations, OutboundNetworkDependenciesEndpointsOperations, PolicyDescriptionOperations, PolicyOperations, PortalRevisionOperations, PortalSettingsOperations, PrivateEndpointConnectionOperations, ProductApiOperations, ProductGroupOperations, ProductOperations, ProductPolicyOperations, ProductSubscriptionsOperations, QuotaByCounterKeysOperations, QuotaByPeriodKeysOperations, RegionOperations, ReportsOperations, SignInSettingsOperations, SignUpSettingsOperations, SubscriptionOperations, TagOperations, TagResourceOperations, TenantAccessGitOperations, TenantAccessOperations, TenantConfigurationOperations, TenantSettingsOperations, UserConfirmationPasswordOperations, UserGroupOperations, UserIdentitiesOperations, UserOperations, UserSubscriptionOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ApiManagementClientConfiguration -from .operations import ApiOperations -from .operations import ApiRevisionOperations -from .operations import ApiReleaseOperations -from .operations import ApiOperationOperations -from .operations import ApiOperationPolicyOperations -from .operations import TagOperations -from .operations import ApiProductOperations -from .operations import ApiPolicyOperations -from .operations import ApiSchemaOperations -from .operations import ApiDiagnosticOperations -from .operations import ApiIssueOperations -from .operations import ApiIssueCommentOperations -from .operations import ApiIssueAttachmentOperations -from .operations import ApiTagDescriptionOperations -from .operations import OperationOperations -from .operations import ApiExportOperations -from .operations import ApiVersionSetOperations -from .operations import AuthorizationServerOperations -from .operations import BackendOperations -from .operations import CacheOperations -from .operations import CertificateOperations -from .operations import ContentTypeOperations -from .operations import ContentItemOperations -from .operations import DeletedServicesOperations -from .operations import ApiManagementOperationsOperations -from .operations import ApiManagementServiceSkusOperations -from .operations import ApiManagementServiceOperations -from .operations import DiagnosticOperations -from .operations import EmailTemplateOperations -from .operations import GatewayOperations -from .operations import GatewayHostnameConfigurationOperations -from .operations import GatewayApiOperations -from .operations import GatewayCertificateAuthorityOperations -from .operations import GroupOperations -from .operations import GroupUserOperations -from .operations import IdentityProviderOperations -from .operations import IssueOperations -from .operations import LoggerOperations -from .operations import NamedValueOperations -from .operations import NetworkStatusOperations -from .operations import NotificationOperations -from .operations import NotificationRecipientUserOperations -from .operations import NotificationRecipientEmailOperations -from .operations import OpenIdConnectProviderOperations -from .operations import PolicyOperations -from .operations import PolicyDescriptionOperations -from .operations import PortalRevisionOperations -from .operations import PortalSettingsOperations -from .operations import SignInSettingsOperations -from .operations import SignUpSettingsOperations -from .operations import DelegationSettingsOperations -from .operations import ProductOperations -from .operations import ProductApiOperations -from .operations import ProductGroupOperations -from .operations import ProductSubscriptionsOperations -from .operations import ProductPolicyOperations -from .operations import QuotaByCounterKeysOperations -from .operations import QuotaByPeriodKeysOperations -from .operations import RegionOperations -from .operations import ReportsOperations -from .operations import TenantSettingsOperations -from .operations import ApiManagementSkusOperations -from .operations import SubscriptionOperations -from .operations import TagResourceOperations -from .operations import TenantAccessOperations -from .operations import TenantAccessGitOperations -from .operations import TenantConfigurationOperations -from .operations import UserOperations -from .operations import UserGroupOperations -from .operations import UserSubscriptionOperations -from .operations import UserIdentitiesOperations -from .operations import UserConfirmationPasswordOperations -from .. import models - - -class ApiManagementClient(object): +class ApiManagementClient(ApiManagementClientOperationsMixin): """ApiManagement Client. :ivar api: ApiOperations operations @@ -104,7 +33,8 @@ class ApiManagementClient(object): :ivar api_operation: ApiOperationOperations operations :vartype api_operation: azure.mgmt.apimanagement.aio.operations.ApiOperationOperations :ivar api_operation_policy: ApiOperationPolicyOperations operations - :vartype api_operation_policy: azure.mgmt.apimanagement.aio.operations.ApiOperationPolicyOperations + :vartype api_operation_policy: + azure.mgmt.apimanagement.aio.operations.ApiOperationPolicyOperations :ivar tag: TagOperations operations :vartype tag: azure.mgmt.apimanagement.aio.operations.TagOperations :ivar api_product: ApiProductOperations operations @@ -120,9 +50,11 @@ class ApiManagementClient(object): :ivar api_issue_comment: ApiIssueCommentOperations operations :vartype api_issue_comment: azure.mgmt.apimanagement.aio.operations.ApiIssueCommentOperations :ivar api_issue_attachment: ApiIssueAttachmentOperations operations - :vartype api_issue_attachment: azure.mgmt.apimanagement.aio.operations.ApiIssueAttachmentOperations + :vartype api_issue_attachment: + azure.mgmt.apimanagement.aio.operations.ApiIssueAttachmentOperations :ivar api_tag_description: ApiTagDescriptionOperations operations - :vartype api_tag_description: azure.mgmt.apimanagement.aio.operations.ApiTagDescriptionOperations + :vartype api_tag_description: + azure.mgmt.apimanagement.aio.operations.ApiTagDescriptionOperations :ivar operation: OperationOperations operations :vartype operation: azure.mgmt.apimanagement.aio.operations.OperationOperations :ivar api_export: ApiExportOperations operations @@ -130,7 +62,8 @@ class ApiManagementClient(object): :ivar api_version_set: ApiVersionSetOperations operations :vartype api_version_set: azure.mgmt.apimanagement.aio.operations.ApiVersionSetOperations :ivar authorization_server: AuthorizationServerOperations operations - :vartype authorization_server: azure.mgmt.apimanagement.aio.operations.AuthorizationServerOperations + :vartype authorization_server: + azure.mgmt.apimanagement.aio.operations.AuthorizationServerOperations :ivar backend: BackendOperations operations :vartype backend: azure.mgmt.apimanagement.aio.operations.BackendOperations :ivar cache: CacheOperations operations @@ -144,11 +77,14 @@ class ApiManagementClient(object): :ivar deleted_services: DeletedServicesOperations operations :vartype deleted_services: azure.mgmt.apimanagement.aio.operations.DeletedServicesOperations :ivar api_management_operations: ApiManagementOperationsOperations operations - :vartype api_management_operations: azure.mgmt.apimanagement.aio.operations.ApiManagementOperationsOperations + :vartype api_management_operations: + azure.mgmt.apimanagement.aio.operations.ApiManagementOperationsOperations :ivar api_management_service_skus: ApiManagementServiceSkusOperations operations - :vartype api_management_service_skus: azure.mgmt.apimanagement.aio.operations.ApiManagementServiceSkusOperations + :vartype api_management_service_skus: + azure.mgmt.apimanagement.aio.operations.ApiManagementServiceSkusOperations :ivar api_management_service: ApiManagementServiceOperations operations - :vartype api_management_service: azure.mgmt.apimanagement.aio.operations.ApiManagementServiceOperations + :vartype api_management_service: + azure.mgmt.apimanagement.aio.operations.ApiManagementServiceOperations :ivar diagnostic: DiagnosticOperations operations :vartype diagnostic: azure.mgmt.apimanagement.aio.operations.DiagnosticOperations :ivar email_template: EmailTemplateOperations operations @@ -156,11 +92,13 @@ class ApiManagementClient(object): :ivar gateway: GatewayOperations operations :vartype gateway: azure.mgmt.apimanagement.aio.operations.GatewayOperations :ivar gateway_hostname_configuration: GatewayHostnameConfigurationOperations operations - :vartype gateway_hostname_configuration: azure.mgmt.apimanagement.aio.operations.GatewayHostnameConfigurationOperations + :vartype gateway_hostname_configuration: + azure.mgmt.apimanagement.aio.operations.GatewayHostnameConfigurationOperations :ivar gateway_api: GatewayApiOperations operations :vartype gateway_api: azure.mgmt.apimanagement.aio.operations.GatewayApiOperations :ivar gateway_certificate_authority: GatewayCertificateAuthorityOperations operations - :vartype gateway_certificate_authority: azure.mgmt.apimanagement.aio.operations.GatewayCertificateAuthorityOperations + :vartype gateway_certificate_authority: + azure.mgmt.apimanagement.aio.operations.GatewayCertificateAuthorityOperations :ivar group: GroupOperations operations :vartype group: azure.mgmt.apimanagement.aio.operations.GroupOperations :ivar group_user: GroupUserOperations operations @@ -178,15 +116,23 @@ class ApiManagementClient(object): :ivar notification: NotificationOperations operations :vartype notification: azure.mgmt.apimanagement.aio.operations.NotificationOperations :ivar notification_recipient_user: NotificationRecipientUserOperations operations - :vartype notification_recipient_user: azure.mgmt.apimanagement.aio.operations.NotificationRecipientUserOperations + :vartype notification_recipient_user: + azure.mgmt.apimanagement.aio.operations.NotificationRecipientUserOperations :ivar notification_recipient_email: NotificationRecipientEmailOperations operations - :vartype notification_recipient_email: azure.mgmt.apimanagement.aio.operations.NotificationRecipientEmailOperations + :vartype notification_recipient_email: + azure.mgmt.apimanagement.aio.operations.NotificationRecipientEmailOperations :ivar open_id_connect_provider: OpenIdConnectProviderOperations operations - :vartype open_id_connect_provider: azure.mgmt.apimanagement.aio.operations.OpenIdConnectProviderOperations + :vartype open_id_connect_provider: + azure.mgmt.apimanagement.aio.operations.OpenIdConnectProviderOperations + :ivar outbound_network_dependencies_endpoints: OutboundNetworkDependenciesEndpointsOperations + operations + :vartype outbound_network_dependencies_endpoints: + azure.mgmt.apimanagement.aio.operations.OutboundNetworkDependenciesEndpointsOperations :ivar policy: PolicyOperations operations :vartype policy: azure.mgmt.apimanagement.aio.operations.PolicyOperations :ivar policy_description: PolicyDescriptionOperations operations - :vartype policy_description: azure.mgmt.apimanagement.aio.operations.PolicyDescriptionOperations + :vartype policy_description: + azure.mgmt.apimanagement.aio.operations.PolicyDescriptionOperations :ivar portal_revision: PortalRevisionOperations operations :vartype portal_revision: azure.mgmt.apimanagement.aio.operations.PortalRevisionOperations :ivar portal_settings: PortalSettingsOperations operations @@ -196,7 +142,11 @@ class ApiManagementClient(object): :ivar sign_up_settings: SignUpSettingsOperations operations :vartype sign_up_settings: azure.mgmt.apimanagement.aio.operations.SignUpSettingsOperations :ivar delegation_settings: DelegationSettingsOperations operations - :vartype delegation_settings: azure.mgmt.apimanagement.aio.operations.DelegationSettingsOperations + :vartype delegation_settings: + azure.mgmt.apimanagement.aio.operations.DelegationSettingsOperations + :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations + :vartype private_endpoint_connection: + azure.mgmt.apimanagement.aio.operations.PrivateEndpointConnectionOperations :ivar product: ProductOperations operations :vartype product: azure.mgmt.apimanagement.aio.operations.ProductOperations :ivar product_api: ProductApiOperations operations @@ -204,21 +154,27 @@ class ApiManagementClient(object): :ivar product_group: ProductGroupOperations operations :vartype product_group: azure.mgmt.apimanagement.aio.operations.ProductGroupOperations :ivar product_subscriptions: ProductSubscriptionsOperations operations - :vartype product_subscriptions: azure.mgmt.apimanagement.aio.operations.ProductSubscriptionsOperations + :vartype product_subscriptions: + azure.mgmt.apimanagement.aio.operations.ProductSubscriptionsOperations :ivar product_policy: ProductPolicyOperations operations :vartype product_policy: azure.mgmt.apimanagement.aio.operations.ProductPolicyOperations :ivar quota_by_counter_keys: QuotaByCounterKeysOperations operations - :vartype quota_by_counter_keys: azure.mgmt.apimanagement.aio.operations.QuotaByCounterKeysOperations + :vartype quota_by_counter_keys: + azure.mgmt.apimanagement.aio.operations.QuotaByCounterKeysOperations :ivar quota_by_period_keys: QuotaByPeriodKeysOperations operations - :vartype quota_by_period_keys: azure.mgmt.apimanagement.aio.operations.QuotaByPeriodKeysOperations + :vartype quota_by_period_keys: + azure.mgmt.apimanagement.aio.operations.QuotaByPeriodKeysOperations :ivar region: RegionOperations operations :vartype region: azure.mgmt.apimanagement.aio.operations.RegionOperations :ivar reports: ReportsOperations operations :vartype reports: azure.mgmt.apimanagement.aio.operations.ReportsOperations + :ivar global_schema: GlobalSchemaOperations operations + :vartype global_schema: azure.mgmt.apimanagement.aio.operations.GlobalSchemaOperations :ivar tenant_settings: TenantSettingsOperations operations :vartype tenant_settings: azure.mgmt.apimanagement.aio.operations.TenantSettingsOperations :ivar api_management_skus: ApiManagementSkusOperations operations - :vartype api_management_skus: azure.mgmt.apimanagement.aio.operations.ApiManagementSkusOperations + :vartype api_management_skus: + azure.mgmt.apimanagement.aio.operations.ApiManagementSkusOperations :ivar subscription: SubscriptionOperations operations :vartype subscription: azure.mgmt.apimanagement.aio.operations.SubscriptionOperations :ivar tag_resource: TagResourceOperations operations @@ -228,7 +184,8 @@ class ApiManagementClient(object): :ivar tenant_access_git: TenantAccessGitOperations operations :vartype tenant_access_git: azure.mgmt.apimanagement.aio.operations.TenantAccessGitOperations :ivar tenant_configuration: TenantConfigurationOperations operations - :vartype tenant_configuration: azure.mgmt.apimanagement.aio.operations.TenantConfigurationOperations + :vartype tenant_configuration: + azure.mgmt.apimanagement.aio.operations.TenantConfigurationOperations :ivar user: UserOperations operations :vartype user: azure.mgmt.apimanagement.aio.operations.UserOperations :ivar user_group: UserGroupOperations operations @@ -238,193 +195,135 @@ class ApiManagementClient(object): :ivar user_identities: UserIdentitiesOperations operations :vartype user_identities: azure.mgmt.apimanagement.aio.operations.UserIdentitiesOperations :ivar user_confirmation_password: UserConfirmationPasswordOperations operations - :vartype user_confirmation_password: azure.mgmt.apimanagement.aio.operations.UserConfirmationPasswordOperations + :vartype user_confirmation_password: + azure.mgmt.apimanagement.aio.operations.UserConfirmationPasswordOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ApiManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ApiManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.api = ApiOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_revision = ApiRevisionOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_release = ApiReleaseOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_operation = ApiOperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_operation_policy = ApiOperationPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.tag = TagOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_product = ApiProductOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_policy = ApiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_schema = ApiSchemaOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_diagnostic = ApiDiagnosticOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_issue = ApiIssueOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_issue_comment = ApiIssueCommentOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_issue_attachment = ApiIssueAttachmentOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_tag_description = ApiTagDescriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_export = ApiExportOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_set = ApiVersionSetOperations(self._client, self._config, self._serialize, self._deserialize) + self.authorization_server = AuthorizationServerOperations(self._client, self._config, self._serialize, self._deserialize) + self.backend = BackendOperations(self._client, self._config, self._serialize, self._deserialize) + self.cache = CacheOperations(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_item = ContentItemOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_services = DeletedServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_operations = ApiManagementOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_service_skus = ApiManagementServiceSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_service = ApiManagementServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.diagnostic = DiagnosticOperations(self._client, self._config, self._serialize, self._deserialize) + self.email_template = EmailTemplateOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway = GatewayOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_api = GatewayApiOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_certificate_authority = GatewayCertificateAuthorityOperations(self._client, self._config, self._serialize, self._deserialize) + self.group = GroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.group_user = GroupUserOperations(self._client, self._config, self._serialize, self._deserialize) + self.identity_provider = IdentityProviderOperations(self._client, self._config, self._serialize, self._deserialize) + self.issue = IssueOperations(self._client, self._config, self._serialize, self._deserialize) + self.logger = LoggerOperations(self._client, self._config, self._serialize, self._deserialize) + self.named_value = NamedValueOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_status = NetworkStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification = NotificationOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification_recipient_user = NotificationRecipientUserOperations(self._client, self._config, self._serialize, self._deserialize) + self.notification_recipient_email = NotificationRecipientEmailOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_id_connect_provider = OpenIdConnectProviderOperations(self._client, self._config, self._serialize, self._deserialize) + self.outbound_network_dependencies_endpoints = OutboundNetworkDependenciesEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.policy = PolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.policy_description = PolicyDescriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.portal_revision = PortalRevisionOperations(self._client, self._config, self._serialize, self._deserialize) + self.portal_settings = PortalSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sign_in_settings = SignInSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sign_up_settings = SignUpSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.delegation_settings = DelegationSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connection = PrivateEndpointConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.product = ProductOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_api = ProductApiOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_group = ProductGroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_subscriptions = ProductSubscriptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.product_policy = ProductPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota_by_counter_keys = QuotaByCounterKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.quota_by_period_keys = QuotaByPeriodKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.region = RegionOperations(self._client, self._config, self._serialize, self._deserialize) + self.reports = ReportsOperations(self._client, self._config, self._serialize, self._deserialize) + self.global_schema = GlobalSchemaOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_settings = TenantSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_management_skus = ApiManagementSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription = SubscriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.tag_resource = TagResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_access = TenantAccessOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_access_git = TenantAccessGitOperations(self._client, self._config, self._serialize, self._deserialize) + self.tenant_configuration = TenantConfigurationOperations(self._client, self._config, self._serialize, self._deserialize) + self.user = UserOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_group = UserGroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_subscription = UserSubscriptionOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_identities = UserIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_confirmation_password = UserConfirmationPasswordOperations(self._client, self._config, self._serialize, self._deserialize) - self.api = ApiOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_revision = ApiRevisionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_release = ApiReleaseOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_operation = ApiOperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_operation_policy = ApiOperationPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag = TagOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_product = ApiProductOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_policy = ApiPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_schema = ApiSchemaOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_diagnostic = ApiDiagnosticOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_issue = ApiIssueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_issue_comment = ApiIssueCommentOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_issue_attachment = ApiIssueAttachmentOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_tag_description = ApiTagDescriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_export = ApiExportOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_version_set = ApiVersionSetOperations( - self._client, self._config, self._serialize, self._deserialize) - self.authorization_server = AuthorizationServerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backend = BackendOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cache = CacheOperations( - 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_item = ContentItemOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deleted_services = DeletedServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_operations = ApiManagementOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_service_skus = ApiManagementServiceSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_service = ApiManagementServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.diagnostic = DiagnosticOperations( - self._client, self._config, self._serialize, self._deserialize) - self.email_template = EmailTemplateOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway = GatewayOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_hostname_configuration = GatewayHostnameConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_api = GatewayApiOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_certificate_authority = GatewayCertificateAuthorityOperations( - self._client, self._config, self._serialize, self._deserialize) - self.group = GroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.group_user = GroupUserOperations( - self._client, self._config, self._serialize, self._deserialize) - self.identity_provider = IdentityProviderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.issue = IssueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.logger = LoggerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.named_value = NamedValueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.network_status = NetworkStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification = NotificationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification_recipient_user = NotificationRecipientUserOperations( - self._client, self._config, self._serialize, self._deserialize) - self.notification_recipient_email = NotificationRecipientEmailOperations( - self._client, self._config, self._serialize, self._deserialize) - self.open_id_connect_provider = OpenIdConnectProviderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.policy = PolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.policy_description = PolicyDescriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.portal_revision = PortalRevisionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.portal_settings = PortalSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sign_in_settings = SignInSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sign_up_settings = SignUpSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.delegation_settings = DelegationSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product = ProductOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_api = ProductApiOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_group = ProductGroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_subscriptions = ProductSubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.product_policy = ProductPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota_by_counter_keys = QuotaByCounterKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.quota_by_period_keys = QuotaByPeriodKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.region = RegionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.reports = ReportsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_settings = TenantSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_management_skus = ApiManagementSkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.subscription = SubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tag_resource = TagResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_access = TenantAccessOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_access_git = TenantAccessGitOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenant_configuration = TenantConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user = UserOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_group = UserGroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_subscription = UserSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_identities = UserIdentitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_confirmation_password = UserConfirmationPasswordOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py index 4e5bc34cdd4f..d049edf46f0a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ApiManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ApiManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-12-01" + self.api_version = "2021-08-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-apimanagement/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_patch.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py index cd77fa38b0ba..9f8b6482fabb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/__init__.py @@ -27,6 +27,7 @@ from ._backend_operations import BackendOperations from ._cache_operations import CacheOperations from ._certificate_operations import CertificateOperations +from ._api_management_client_operations import ApiManagementClientOperationsMixin from ._content_type_operations import ContentTypeOperations from ._content_item_operations import ContentItemOperations from ._deleted_services_operations import DeletedServicesOperations @@ -50,6 +51,7 @@ from ._notification_recipient_user_operations import NotificationRecipientUserOperations from ._notification_recipient_email_operations import NotificationRecipientEmailOperations from ._open_id_connect_provider_operations import OpenIdConnectProviderOperations +from ._outbound_network_dependencies_endpoints_operations import OutboundNetworkDependenciesEndpointsOperations from ._policy_operations import PolicyOperations from ._policy_description_operations import PolicyDescriptionOperations from ._portal_revision_operations import PortalRevisionOperations @@ -57,6 +59,7 @@ from ._sign_in_settings_operations import SignInSettingsOperations from ._sign_up_settings_operations import SignUpSettingsOperations from ._delegation_settings_operations import DelegationSettingsOperations +from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations from ._product_operations import ProductOperations from ._product_api_operations import ProductApiOperations from ._product_group_operations import ProductGroupOperations @@ -66,6 +69,7 @@ from ._quota_by_period_keys_operations import QuotaByPeriodKeysOperations from ._region_operations import RegionOperations from ._reports_operations import ReportsOperations +from ._global_schema_operations import GlobalSchemaOperations from ._tenant_settings_operations import TenantSettingsOperations from ._api_management_skus_operations import ApiManagementSkusOperations from ._subscription_operations import SubscriptionOperations @@ -101,6 +105,7 @@ 'BackendOperations', 'CacheOperations', 'CertificateOperations', + 'ApiManagementClientOperationsMixin', 'ContentTypeOperations', 'ContentItemOperations', 'DeletedServicesOperations', @@ -124,6 +129,7 @@ 'NotificationRecipientUserOperations', 'NotificationRecipientEmailOperations', 'OpenIdConnectProviderOperations', + 'OutboundNetworkDependenciesEndpointsOperations', 'PolicyOperations', 'PolicyDescriptionOperations', 'PortalRevisionOperations', @@ -131,6 +137,7 @@ 'SignInSettingsOperations', 'SignUpSettingsOperations', 'DelegationSettingsOperations', + 'PrivateEndpointConnectionOperations', 'ProductOperations', 'ProductApiOperations', 'ProductGroupOperations', @@ -140,6 +147,7 @@ 'QuotaByPeriodKeysOperations', 'RegionOperations', 'ReportsOperations', + 'GlobalSchemaOperations', 'TenantSettingsOperations', 'ApiManagementSkusOperations', 'SubscriptionOperations', diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py index 4c25c494f732..607a08db78a1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_diagnostic_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_diagnostic_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -68,8 +74,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiagnosticCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticCollection] + :return: An iterator like instance of either DiagnosticCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticCollection"] @@ -77,43 +85,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiagnosticCollection', pipeline_response) + deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,17 +132,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -166,46 +174,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -235,47 +236,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -312,59 +307,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -401,53 +390,47 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -481,39 +464,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py index 453c7694850b..2ab48b265964 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_export_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_export_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,36 +79,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['export'] = self._serialize.query("export", export, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + format=format, + export=export, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiExportResult', pipeline_response) @@ -112,4 +107,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py index 36001d53d5f5..fd23c178d12e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_attachment_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_issue_attachment_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -73,8 +79,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IssueAttachmentCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueAttachmentCollection] + :return: An iterator like instance of either IssueAttachmentCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueAttachmentCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IssueAttachmentCollection"] @@ -82,44 +90,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IssueAttachmentCollection', pipeline_response) + deserialized = self._deserialize("IssueAttachmentCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +139,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -177,47 +186,40 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -251,48 +253,42 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueAttachmentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -333,60 +329,54 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueAttachmentContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueAttachmentContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueAttachmentContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueAttachmentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -424,40 +414,31 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py index 386dbb118f68..5db9f3354de0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_comment_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_issue_comment_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -73,8 +79,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IssueCommentCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueCommentCollection] + :return: An iterator like instance of either IssueCommentCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueCommentCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IssueCommentCollection"] @@ -82,44 +90,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IssueCommentCollection', pipeline_response) + deserialized = self._deserialize("IssueCommentCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +139,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -176,47 +185,40 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -249,48 +251,42 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueCommentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -330,60 +326,54 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueCommentContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueCommentContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueCommentContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueCommentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -420,40 +410,31 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py index d217cf31e9d8..b2453f81c600 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_issue_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_issue_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -74,7 +80,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IssueCollection"] @@ -82,45 +89,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand_comments_attachments is not None: - query_parameters['expandCommentsAttachments'] = self._serialize.query("expand_comments_attachments", expand_comments_attachments, 'bool') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + expand_comments_attachments=expand_comments_attachments, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + expand_comments_attachments=expand_comments_attachments, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IssueCollection', pipeline_response) + deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +138,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -173,46 +180,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -245,49 +245,42 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand_comments_attachments is not None: - query_parameters['expandCommentsAttachments'] = self._serialize.query("expand_comments_attachments", expand_comments_attachments, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + expand_comments_attachments=expand_comments_attachments, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -324,59 +317,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -413,53 +400,47 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -493,39 +474,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py new file mode 100644 index 000000000000..e7b53e97e7d5 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_client_operations.py @@ -0,0 +1,148 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_management_client_operations import build_perform_connectivity_check_async_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApiManagementClientOperationsMixin: + + async def _perform_connectivity_check_async_initial( + self, + resource_group_name: str, + service_name: str, + connectivity_check_request_params: "_models.ConnectivityCheckRequest", + **kwargs: Any + ) -> Optional["_models.ConnectivityCheckResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConnectivityCheckResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connectivity_check_request_params, 'ConnectivityCheckRequest') + + request = build_perform_connectivity_check_async_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_connectivity_check_async_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConnectivityCheckResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _perform_connectivity_check_async_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck'} # type: ignore + + + @distributed_trace_async + async def begin_perform_connectivity_check_async( + self, + resource_group_name: str, + service_name: str, + connectivity_check_request_params: "_models.ConnectivityCheckRequest", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConnectivityCheckResponse"]: + """Performs a connectivity check between the API Management service and a given destination, and + returns metrics for the connection, as well as errors encountered while trying to establish it. + + :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 connectivity_check_request_params: Connectivity Check request parameters. + :type connectivity_check_request_params: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConnectivityCheckResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ConnectivityCheckResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityCheckResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_connectivity_check_async_initial( + resource_group_name=resource_group_name, + service_name=service_name, + connectivity_check_request_params=connectivity_check_request_params, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConnectivityCheckResponse', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_connectivity_check_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py index bc927cf54fd7..9faf7e893832 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_operations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_management_operations_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py index 1792c41673d5..80883aa9d9b9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_management_service_operations import build_apply_network_configuration_updates_request_initial, build_backup_request_initial, build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_domain_ownership_identifier_request, build_get_request, build_get_sso_token_request, build_list_by_resource_group_request, build_list_request, build_restore_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,39 +60,28 @@ async def _restore_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') + + request = build_restore_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -97,8 +91,11 @@ async def _restore_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore'} # type: ignore + + @distributed_trace_async async def begin_restore( self, resource_group_name: str, @@ -119,15 +116,20 @@ async def begin_restore( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,27 +141,21 @@ async def begin_restore( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -171,6 +167,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore'} # type: ignore async def _backup_initial( @@ -185,39 +182,28 @@ async def _backup_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._backup_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_backup_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -227,8 +213,11 @@ async def _backup_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup'} # type: ignore + + @distributed_trace_async async def begin_backup( self, resource_group_name: str, @@ -247,15 +236,20 @@ async def begin_backup( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,27 +261,21 @@ async def begin_backup( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -299,6 +287,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup'} # type: ignore async def _create_or_update_initial( @@ -313,39 +302,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ApiManagementServiceResource') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -358,8 +336,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -378,15 +359,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -398,27 +384,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -430,6 +410,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore async def _update_initial( @@ -444,39 +425,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiManagementServiceUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -486,8 +456,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -505,15 +478,20 @@ async def begin_update( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -525,27 +503,21 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -557,8 +529,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -581,33 +555,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) @@ -616,8 +580,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -629,34 +595,23 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 202: @@ -666,8 +621,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -682,15 +640,19 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -704,24 +666,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -733,8 +688,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -745,8 +702,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiManagementServiceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] + :return: An iterator like instance of either ApiManagementServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceListResult"] @@ -754,35 +713,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiManagementServiceListResult', pipeline_response) + deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -795,17 +750,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -813,8 +770,10 @@ def list( """Lists all API Management services within an Azure subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiManagementServiceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] + :return: An iterator like instance of either ApiManagementServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceListResult"] @@ -822,34 +781,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiManagementServiceListResult', pipeline_response) + deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -862,17 +816,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service'} # type: ignore + @distributed_trace_async async def get_sso_token( self, resource_group_name: str, @@ -895,33 +851,23 @@ async def get_sso_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_sso_token.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_sso_token_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_sso_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceGetSsoTokenResult', pipeline_response) @@ -930,8 +876,11 @@ async def get_sso_token( return cls(pipeline_response, deserialized, {}) return deserialized + get_sso_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken'} # type: ignore + + @distributed_trace_async async def check_name_availability( self, parameters: "_models.ApiManagementServiceCheckNameAvailabilityParameters", @@ -940,7 +889,8 @@ async def check_name_availability( """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters + :type parameters: + ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult @@ -951,36 +901,26 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ApiManagementServiceCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceNameAvailabilityResult', pipeline_response) @@ -989,8 +929,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get_domain_ownership_identifier( self, **kwargs: Any @@ -1007,31 +950,21 @@ async def get_domain_ownership_identifier( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - # Construct URL - url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_domain_ownership_identifier_request( + subscription_id=self._config.subscription_id, + template_url=self.get_domain_ownership_identifier.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceGetDomainOwnershipIdentifierResult', pipeline_response) @@ -1040,8 +973,10 @@ async def get_domain_ownership_identifier( return cls(pipeline_response, deserialized, {}) return deserialized + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier'} # type: ignore + async def _apply_network_configuration_updates_initial( self, resource_group_name: str, @@ -1054,42 +989,31 @@ async def _apply_network_configuration_updates_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._apply_network_configuration_updates_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ApiManagementServiceApplyNetworkConfigurationParameters') + _json = self._serialize.body(parameters, 'ApiManagementServiceApplyNetworkConfigurationParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_apply_network_configuration_updates_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._apply_network_configuration_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1099,8 +1023,11 @@ async def _apply_network_configuration_updates_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _apply_network_configuration_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates'} # type: ignore + + @distributed_trace_async async def begin_apply_network_configuration_updates( self, resource_group_name: str, @@ -1118,18 +1045,24 @@ async def begin_apply_network_configuration_updates( :param parameters: Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters + :type parameters: + ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -1141,27 +1074,21 @@ async def begin_apply_network_configuration_updates( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1173,4 +1100,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_apply_network_configuration_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py index 03975ed40cc8..beef8124fdd4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_service_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_management_service_skus_operations import build_list_available_service_skus_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_available_service_skus( self, resource_group_name: str, @@ -57,7 +63,8 @@ def list_available_service_skus( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkuResults or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ResourceSkuResults] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ResourceSkuResults] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuResults"] @@ -65,36 +72,33 @@ def list_available_service_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_available_service_skus.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_service_skus_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_service_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_service_skus_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuResults', pipeline_response) + deserialized = self._deserialize("ResourceSkuResults", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,12 +111,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py index ab2509d59ff6..f0aedabd075e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_management_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_management_skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiManagementSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementSkusResult] + :return: An iterator like instance of either ApiManagementSkusResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiManagementSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementSkusResult"] @@ -57,34 +65,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiManagementSkusResult', pipeline_response) + deserialized = self._deserialize("ApiManagementSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,12 +100,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py index 8aaa20a8a1f6..8c02024349ef 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_operation_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_api_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name: str, @@ -78,7 +84,8 @@ def list_by_api( :type tags: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OperationCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OperationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationCollection"] @@ -86,45 +93,43 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationCollection', pipeline_response) + deserialized = self._deserialize("OperationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +142,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -178,46 +185,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -248,47 +248,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -326,59 +320,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OperationContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OperationContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -416,53 +404,47 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OperationUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OperationUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -497,39 +479,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py index fb2c7d9fd81b..81fa5c2f9fbc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operation_policy_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_operation_policy_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_operation_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_operation( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def list_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -107,8 +102,11 @@ async def list_by_operation( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies'} # type: ignore + + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -142,47 +140,40 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -219,50 +210,43 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -303,60 +287,54 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,40 +372,31 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py index fe463e1add60..e6614d7ab4b6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_operations import build_create_or_update_request_initial, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_by_tags_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -87,46 +93,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, 'str') - if expand_api_version_set is not None: - query_parameters['expandApiVersionSet'] = self._serialize.query("expand_api_version_set", expand_api_version_set, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + expand_api_version_set=expand_api_version_set, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + expand_api_version_set=expand_api_version_set, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiCollection', pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -139,17 +142,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -176,45 +181,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -241,51 +239,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json, application/vnd.swagger.doc+json, application/vnd.oai.openapi+json, application/vnd.sun.wadl+xml, application/wsdl+xml" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 200]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) - deserialized = self._deserialize('ApiContract', pipeline_response) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) - if response.status_code == 200: - response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) - deserialized = self._deserialize('ApiContract', pipeline_response) + deserialized = self._deserialize('ApiContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -300,59 +286,52 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiCreateOrUpdateParameter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiCreateOrUpdateParameter') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -378,15 +357,19 @@ async def begin_create_or_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiContract or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.ApiContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -400,31 +383,24 @@ async def begin_create_or_update( api_id=api_id, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,8 +412,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -471,52 +449,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -550,37 +522,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if delete_revisions is not None: - query_parameters['deleteRevisions'] = self._serialize.query("delete_revisions", delete_revisions, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + delete_revisions=delete_revisions, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -588,6 +549,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace def list_by_tags( self, resource_group_name: str, @@ -621,8 +584,10 @@ def list_by_tags( :param include_not_tagged_apis: Include not tagged APIs. :type include_not_tagged_apis: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TagResourceCollection"] @@ -630,44 +595,41 @@ def list_by_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_tags.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if include_not_tagged_apis is not None: - query_parameters['includeNotTaggedApis'] = self._serialize.query("include_not_tagged_apis", include_not_tagged_apis, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_apis=include_not_tagged_apis, + template_url=self.list_by_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_apis=include_not_tagged_apis, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -680,12 +642,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py index f6f1273fc02e..6160e8cfd301 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_policy_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_policy_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_api_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_api( self, resource_group_name: str, @@ -66,34 +71,24 @@ async def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -102,8 +97,11 @@ async def list_by_api( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies'} # type: ignore + + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -133,46 +131,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,54 +196,48 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -289,59 +274,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -375,39 +354,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py index 25e68904c8b7..0397acd9cf3c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_product_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_product_operations import build_list_by_apis_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_apis( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list_by_apis( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProductCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductCollection"] @@ -77,43 +84,41 @@ def list_by_apis( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_apis.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_apis_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_apis.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_apis_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProductCollection', pipeline_response) + deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,12 +131,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py index db09304b22f9..d09ddff0db11 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_release_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_release_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -70,8 +76,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiReleaseCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseCollection] + :return: An iterator like instance of either ApiReleaseCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiReleaseCollection"] @@ -79,43 +87,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiReleaseCollection', pipeline_response) + deserialized = self._deserialize("ApiReleaseCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -128,17 +134,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -168,46 +176,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -237,47 +238,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -314,59 +309,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiReleaseContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiReleaseContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -403,53 +392,47 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiReleaseContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiReleaseContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -483,39 +466,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py index ab1dd235dd5e..e734599a1e05 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_revision_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_revision_operations import build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -68,8 +74,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiRevisionCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionCollection] + :return: An iterator like instance of either ApiRevisionCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiRevisionCollection"] @@ -77,43 +85,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiRevisionCollection', pipeline_response) + deserialized = self._deserialize("ApiRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,12 +132,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py index 5eb0cf2e5e32..e4b46d1c9af1 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_schema_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_schema_operations import build_create_or_update_request_initial, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_api_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name: str, @@ -72,7 +78,8 @@ def list_by_api( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SchemaCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SchemaCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SchemaCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaCollection"] @@ -80,43 +87,41 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SchemaCollection', pipeline_response) + deserialized = self._deserialize("SchemaCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,17 +134,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -157,8 +164,8 @@ async def get_entity_tag( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: bool, or the result of cls(response) @@ -170,46 +177,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -227,8 +227,8 @@ async def get( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SchemaContract, or the result of cls(response) @@ -240,47 +240,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -296,60 +289,53 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SchemaContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SchemaContract') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -369,8 +355,8 @@ async def begin_create_or_update( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :param parameters: The schema contents to apply. :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract @@ -379,15 +365,19 @@ async def begin_create_or_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SchemaContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SchemaContract or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.SchemaContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -402,32 +392,24 @@ async def begin_create_or_update( schema_id=schema_id, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -439,8 +421,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -460,8 +444,8 @@ async def delete( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -478,41 +462,31 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py index bbaa7ba31a96..8f0c621771ec 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_tag_description_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_tag_description_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -71,8 +77,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagDescriptionCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagDescriptionCollection] + :return: An iterator like instance of either TagDescriptionCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagDescriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TagDescriptionCollection"] @@ -80,43 +88,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagDescriptionCollection', pipeline_response) + deserialized = self._deserialize("TagDescriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,17 +135,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -170,46 +178,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -240,47 +241,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagDescriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -318,59 +313,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagDescriptionCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagDescriptionCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagDescriptionContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagDescriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -405,39 +394,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py index 0c9fc79b133d..97a114daa565 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_api_version_set_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_version_set_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -64,8 +70,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiVersionSetCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiVersionSetCollection] + :return: An iterator like instance of either ApiVersionSetCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ApiVersionSetCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiVersionSetCollection"] @@ -73,42 +81,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiVersionSetCollection', pipeline_response) + deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,17 +126,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -158,45 +165,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -223,46 +223,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -296,58 +290,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiVersionSetContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiVersionSetContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -381,52 +369,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiVersionSetUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiVersionSetUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -457,38 +439,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py index bffd44128243..08417c214513 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_authorization_server_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._authorization_server_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_secrets_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -67,8 +73,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AuthorizationServerCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AuthorizationServerCollection] + :return: An iterator like instance of either AuthorizationServerCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AuthorizationServerCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationServerCollection"] @@ -76,42 +84,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AuthorizationServerCollection', pipeline_response) + deserialized = self._deserialize("AuthorizationServerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,17 +129,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -160,45 +167,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,46 +224,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -296,58 +290,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AuthorizationServerContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AuthorizationServerContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -380,52 +368,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AuthorizationServerUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AuthorizationServerUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -455,35 +437,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -491,6 +463,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace_async async def list_secrets( self, resource_group_name: str, @@ -516,42 +490,35 @@ async def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerSecretsContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py index e3170f9bab85..18c34a2f56b8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_backend_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backend_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_reconnect_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -68,7 +74,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackendCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.BackendCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.BackendCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BackendCollection"] @@ -76,42 +83,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BackendCollection', pipeline_response) + deserialized = self._deserialize("BackendCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,17 +128,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -161,45 +167,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -226,46 +225,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -299,58 +292,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackendContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackendContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -384,52 +371,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackendUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackendUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -460,35 +441,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -496,6 +467,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace_async async def reconnect( self, resource_group_name: str, @@ -526,45 +499,36 @@ async def reconnect( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.reconnect.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'BackendReconnectContract') + _json = self._serialize.body(parameters, 'BackendReconnectContract') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_reconnect_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.reconnect.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) reconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py index 0ea85ee83ff1..900208a7e0b7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_cache_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cache_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -61,7 +67,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CacheCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CacheCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CacheCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CacheCollection"] @@ -69,40 +76,37 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CacheCollection', pipeline_response) + deserialized = self._deserialize("CacheCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +119,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -152,45 +158,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -217,46 +216,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -290,58 +283,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CacheContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CacheContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -375,52 +362,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CacheUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CacheUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -451,38 +432,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py index 0e72299cfb57..40ad3c6727f7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_certificate_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificate_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_refresh_secret_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -72,8 +78,10 @@ def list_by_service( entities which failed refresh. :type is_key_vault_refresh_failed: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CertificateCollection] + :return: An iterator like instance of either CertificateCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.CertificateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] @@ -81,44 +89,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if is_key_vault_refresh_failed is not None: - query_parameters['isKeyVaultRefreshFailed'] = self._serialize.query("is_key_vault_refresh_failed", is_key_vault_refresh_failed, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateCollection', pipeline_response) + deserialized = self._deserialize("CertificateCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,17 +136,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -168,45 +175,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,46 +233,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -306,58 +300,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -388,35 +376,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -424,6 +402,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace_async async def refresh_secret( self, resource_group_name: str, @@ -450,42 +430,35 @@ async def refresh_secret( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.refresh_secret.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_secret_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.refresh_secret.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + refresh_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py index 1cd3e0bdd240..c6f07b4f451b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_item_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._content_item_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_service( :param content_type_id: Content type identifier. :type content_type_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContentItemCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ContentItemCollection] + :return: An iterator like instance of either ContentItemCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ContentItemCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentItemCollection"] @@ -66,37 +74,35 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContentItemCollection', pipeline_response) + deserialized = self._deserialize("ContentItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,17 +115,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -149,46 +157,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -217,47 +218,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentItemContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -290,54 +285,48 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentItemContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentItemContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -370,39 +359,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py index 489858dc5724..b9d3113963f6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_content_type_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._content_type_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -55,8 +61,10 @@ def list_by_service( :param service_name: The name of the API Management service. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContentTypeCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ContentTypeCollection] + :return: An iterator like instance of either ContentTypeCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ContentTypeCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ContentTypeCollection"] @@ -64,36 +72,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ContentTypeCollection', pipeline_response) + deserialized = self._deserialize("ContentTypeCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,17 +111,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -143,46 +150,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentTypeContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -214,53 +215,47 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentTypeContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentTypeContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -292,38 +287,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py index 7d2ec7af5aba..ebd0706890a7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_delegation_settings_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._delegation_settings_operations import build_create_or_update_request, build_get_entity_tag_request, build_get_request, build_list_secrets_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -62,44 +67,37 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -122,45 +120,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalDelegationSettings', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -190,39 +182,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalDelegationSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalDelegationSettings') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -230,6 +212,8 @@ async def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -259,40 +243,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalDelegationSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalDelegationSettings') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalDelegationSettings', pipeline_response) @@ -301,8 +274,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace_async async def list_secrets( self, resource_group_name: str, @@ -325,33 +301,23 @@ async def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSettingValidationKeyContract', pipeline_response) @@ -360,4 +326,6 @@ async def list_secrets( return cls(pipeline_response, deserialized, {}) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py index a9ccead25a57..8081e86f3d1b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_deleted_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deleted_services_operations import build_get_by_name_request, build_list_by_subscription_request, build_purge_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -50,8 +56,10 @@ def list_by_subscription( """Lists all soft-deleted services available for undelete for the given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedServicesCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DeletedServicesCollection] + :return: An iterator like instance of either DeletedServicesCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DeletedServicesCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedServicesCollection"] @@ -59,34 +67,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedServicesCollection', pipeline_response) + deserialized = self._deserialize("DeletedServicesCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,17 +102,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices'} # type: ignore + @distributed_trace_async async def get_by_name( self, service_name: str, @@ -132,33 +137,23 @@ async def get_by_name( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_name.metadata['url'] # type: ignore - path_format_arguments = { - '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'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_name_request( + service_name=service_name, + subscription_id=self._config.subscription_id, + location=location, + template_url=self.get_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedServiceContract', pipeline_response) @@ -167,8 +162,10 @@ async def get_by_name( return cls(pipeline_response, deserialized, {}) return deserialized + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}'} # type: ignore + async def _purge_initial( self, service_name: str, @@ -180,34 +177,23 @@ async def _purge_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - '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'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_request_initial( + service_name=service_name, + subscription_id=self._config.subscription_id, + location=location, + template_url=self._purge_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 202: @@ -217,8 +203,11 @@ async def _purge_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_purge( self, service_name: str, @@ -233,15 +222,19 @@ async def begin_purge( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeletedServiceContract or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.DeletedServiceContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedServiceContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -255,24 +248,17 @@ async def begin_purge( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeletedServiceContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - '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'), - 'location': self._serialize.url("location", location, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -284,4 +270,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py index bdbf1567516e..566f2fdea699 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_diagnostic_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._diagnostic_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -65,8 +71,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiagnosticCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticCollection] + :return: An iterator like instance of either DiagnosticCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.DiagnosticCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DiagnosticCollection"] @@ -74,42 +82,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DiagnosticCollection', pipeline_response) + deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,17 +127,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -159,45 +166,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,46 +224,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -297,58 +291,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -382,52 +370,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -458,38 +440,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py index 2fb72c13e9ac..6a6984be143a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_email_template_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._email_template_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -65,8 +71,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmailTemplateCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.EmailTemplateCollection] + :return: An iterator like instance of either EmailTemplateCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.EmailTemplateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EmailTemplateCollection"] @@ -74,42 +82,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EmailTemplateCollection', pipeline_response) + deserialized = self._deserialize("EmailTemplateCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,17 +127,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -158,45 +165,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -222,46 +222,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('EmailTemplateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -294,41 +288,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -341,8 +324,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -375,52 +361,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('EmailTemplateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -450,38 +430,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py index 9e4f374f6c4b..052e7ad2f9d7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_api_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateway_api_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -78,43 +84,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiCollection', pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,17 +131,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -167,46 +173,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -239,43 +238,33 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'AssociationContract') + _json = self._serialize.body(parameters, 'AssociationContract') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -288,8 +277,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -319,38 +311,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py index 4d2be3a9b8bf..f789a2216314 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_certificate_authority_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateway_certificate_authority_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -69,8 +75,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCertificateAuthorityCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityCollection] + :return: An iterator like instance of either GatewayCertificateAuthorityCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCertificateAuthorityCollection"] @@ -78,43 +86,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayCertificateAuthorityCollection', pipeline_response) + deserialized = self._deserialize("GatewayCertificateAuthorityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,17 +133,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -168,46 +176,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -238,47 +239,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayCertificateAuthorityContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -316,59 +311,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayCertificateAuthorityContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayCertificateAuthorityContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayCertificateAuthorityContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayCertificateAuthorityContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -403,39 +392,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py index 4b4eb4c9325d..2afe3a60e9bb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_hostname_configuration_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateway_hostname_configuration_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -70,8 +76,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayHostnameConfigurationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationCollection] + :return: An iterator like instance of either GatewayHostnameConfigurationCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayHostnameConfigurationCollection"] @@ -79,43 +87,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayHostnameConfigurationCollection', pipeline_response) + deserialized = self._deserialize("GatewayHostnameConfigurationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -128,17 +134,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -170,46 +178,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -240,47 +241,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayHostnameConfigurationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -318,59 +313,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayHostnameConfigurationContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayHostnameConfigurationContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayHostnameConfigurationContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayHostnameConfigurationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -405,39 +394,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py index 87c011a33c58..2c7388ca236e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_gateway_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateway_operations import build_create_or_update_request, build_delete_request, build_generate_token_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_keys_request, build_regenerate_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GatewayCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GatewayCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCollection"] @@ -77,42 +84,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayCollection', pipeline_response) + deserialized = self._deserialize("GatewayCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,17 +129,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -162,45 +168,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -227,46 +226,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -300,58 +293,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -385,52 +372,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -461,35 +442,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -497,6 +468,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -523,46 +496,40 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayKeysContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys'} # type: ignore + + @distributed_trace_async async def regenerate_key( self, resource_group_name: str, @@ -592,39 +559,29 @@ async def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayKeyRegenerationRequestContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayKeyRegenerationRequestContract') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -632,6 +589,8 @@ async def regenerate_key( regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey'} # type: ignore + + @distributed_trace_async async def generate_token( self, resource_group_name: str, @@ -661,39 +620,29 @@ async def generate_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.generate_token.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayTokenRequestContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_generate_token_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.generate_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayTokenRequestContract') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GatewayTokenContract', pipeline_response) @@ -702,4 +651,6 @@ async def generate_token( return cls(pipeline_response, deserialized, {}) return deserialized + generate_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py new file mode 100644 index 000000000000..27ec69135260 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_global_schema_operations.py @@ -0,0 +1,462 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._global_schema_operations import build_create_or_update_request_initial, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GlobalSchemaOperations: + """GlobalSchemaOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.apimanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.GlobalSchemaCollection"]: + """Lists a collection of schemas registered with service instance. + + :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 filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
. + :type filter: str + :param top: Number of records to return. + :type top: int + :param skip: Number of records to skip. + :type skip: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GlobalSchemaCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GlobalSchemaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalSchemaCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas'} # type: ignore + + @distributed_trace_async + async def get_entity_tag( + self, + resource_group_name: str, + service_name: str, + schema_id: str, + **kwargs: Any + ) -> bool: + """Gets the entity state (Etag) version of the Schema specified by its identifier. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + + if cls: + return cls(pipeline_response, None, response_headers) + return 200 <= response.status_code <= 299 + + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + schema_id: str, + **kwargs: Any + ) -> "_models.GlobalSchemaContract": + """Gets the details of the Schema specified by its identifier. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GlobalSchemaContract, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalSchemaContract"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + schema_id: str, + parameters: "_models.GlobalSchemaContract", + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.GlobalSchemaContract"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GlobalSchemaContract"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GlobalSchemaContract') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + + if response.status_code == 201: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + schema_id: str, + parameters: "_models.GlobalSchemaContract", + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.GlobalSchemaContract"]: + """Creates new or updates existing specified Schema of the API Management service instance. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :param parameters: Create or update parameters. + :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract + :param if_match: ETag of the Entity. Not required when creating an entity, but required when + updating an entity. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GlobalSchemaContract or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalSchemaContract"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + parameters=parameters, + if_match=if_match, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + service_name: str, + schema_id: str, + if_match: str, + **kwargs: Any + ) -> None: + """Deletes specific Schema. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :param if_match: ETag of the Entity. ETag should match the current entity state from the header + response of the GET request or it should be * for unconditional update. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py index 61e6e1186b02..cab301982393 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._group_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupCollection"] @@ -77,42 +84,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GroupCollection', pipeline_response) + deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,17 +129,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -162,45 +168,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -227,46 +226,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -300,58 +293,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GroupCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GroupCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -385,52 +372,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GroupUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GroupUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -461,38 +442,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py index e6b9d2fe3f21..2275b467724c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_group_user_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._group_user_operations import build_check_entity_exists_request, build_create_request, build_delete_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -75,7 +81,8 @@ def list( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserCollection"] @@ -83,43 +90,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserCollection', pipeline_response) + deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +137,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users'} # type: ignore + @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, @@ -172,43 +179,35 @@ async def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, min_length=1), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -238,35 +237,25 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, min_length=1), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -279,8 +268,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -310,38 +302,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, min_length=1), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py index 9c83ceff4de9..9f8ae4014596 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_identity_provider_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._identity_provider_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_secrets_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -54,8 +60,10 @@ def list_by_service( :param service_name: The name of the API Management service. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IdentityProviderList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IdentityProviderList] + :return: An iterator like instance of either IdentityProviderList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IdentityProviderList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IdentityProviderList"] @@ -63,36 +71,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IdentityProviderList', pipeline_response) + deserialized = self._deserialize("IdentityProviderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,17 +110,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -141,45 +148,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -206,46 +206,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -278,58 +272,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IdentityProviderCreateContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IdentityProviderCreateContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -362,52 +350,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IdentityProviderUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IdentityProviderUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -437,35 +419,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -473,6 +445,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace_async async def list_secrets( self, resource_group_name: str, @@ -498,42 +472,35 @@ async def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ClientSecretContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py index 9754af78925d..0efd7dc398ff 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_issue_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._issue_operations import build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -71,7 +77,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IssueCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.IssueCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IssueCollection"] @@ -79,42 +86,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IssueCollection', pipeline_response) + deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,17 +131,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -164,42 +170,35 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py index f9870d649878..cfa6293fa75c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_logger_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._logger_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -69,7 +75,8 @@ def list_by_service( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LoggerCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.LoggerCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.LoggerCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LoggerCollection"] @@ -77,42 +84,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LoggerCollection', pipeline_response) + deserialized = self._deserialize("LoggerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,17 +129,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -161,45 +167,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -225,46 +224,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -297,58 +290,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LoggerContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LoggerContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -381,52 +368,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LoggerUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LoggerUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -456,38 +437,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py index 7365d146c549..67c35065f8ca 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_named_value_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._named_value_operations import build_create_or_update_request_initial, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_value_request, build_refresh_secret_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -73,8 +79,10 @@ def list_by_service( entities which failed refresh. :type is_key_vault_refresh_failed: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NamedValueCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NamedValueCollection] + :return: An iterator like instance of either NamedValueCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NamedValueCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueCollection"] @@ -82,44 +90,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if is_key_vault_refresh_failed is not None: - query_parameters['isKeyVaultRefreshFailed'] = self._serialize.query("is_key_vault_refresh_failed", is_key_vault_refresh_failed, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NamedValueCollection', pipeline_response) + deserialized = self._deserialize("NamedValueCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +137,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -168,45 +175,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -232,46 +232,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -286,59 +279,52 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamedValueCreateContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NamedValueCreateContract') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -363,15 +349,19 @@ async def begin_create_or_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,31 +375,24 @@ async def begin_create_or_update( named_value_id=named_value_id, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -421,6 +404,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore async def _update_initial( @@ -437,54 +421,47 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamedValueUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NamedValueUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -509,15 +486,19 @@ async def begin_update( :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -531,31 +512,24 @@ async def begin_update( named_value_id=named_value_id, if_match=if_match, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -567,8 +541,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -598,35 +574,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -634,6 +600,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace_async async def list_value( self, resource_group_name: str, @@ -659,46 +627,39 @@ async def list_value( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_value.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_value_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self.list_value.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueSecretContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_value.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue'} # type: ignore + async def _refresh_secret_initial( self, resource_group_name: str, @@ -711,48 +672,41 @@ async def _refresh_secret_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._refresh_secret_initial.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_secret_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self._refresh_secret_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _refresh_secret_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret'} # type: ignore + + @distributed_trace_async async def begin_refresh_secret( self, resource_group_name: str, @@ -770,15 +724,18 @@ async def begin_refresh_secret( :type named_value_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NamedValueContract or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -793,28 +750,20 @@ async def begin_refresh_secret( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -826,4 +775,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py index 245150098aae..c0f7e75078c2 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_network_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._network_status_operations import build_list_by_location_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_service( self, resource_group_name: str, @@ -64,33 +69,23 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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])?$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[NetworkStatusContractByLocation]', pipeline_response) @@ -99,8 +94,11 @@ async def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus'} # type: ignore + + @distributed_trace_async async def list_by_location( self, resource_group_name: str, @@ -129,34 +127,24 @@ async def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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])?$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + location_name=location_name, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NetworkStatusContract', pipeline_response) @@ -165,4 +153,6 @@ async def list_by_location( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py index a38e1be901f8..1eda64f0f942 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._notification_operations import build_create_or_update_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -60,8 +66,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NotificationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NotificationCollection] + :return: An iterator like instance of either NotificationCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.NotificationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NotificationCollection"] @@ -69,40 +77,37 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NotificationCollection', pipeline_response) + deserialized = self._deserialize("NotificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +120,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -151,34 +158,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotificationContract', pipeline_response) @@ -187,8 +184,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -218,36 +218,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotificationContract', pipeline_response) @@ -256,4 +245,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py index 21634bdac4c8..adf2eb93552e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_email_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._notification_recipient_email_operations import build_check_entity_exists_request, build_create_or_update_request, build_delete_request, build_list_by_notification_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_notification( self, resource_group_name: str, @@ -65,34 +70,24 @@ async def list_by_notification( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_notification.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_notification_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_notification.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RecipientEmailCollection', pipeline_response) @@ -101,8 +96,11 @@ async def list_by_notification( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_notification.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails'} # type: ignore + + @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, @@ -131,43 +129,35 @@ async def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'email': self._serialize.url("email", email, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + email=email, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -196,35 +186,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'email': self._serialize.url("email", email, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + email=email, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -237,8 +217,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -267,38 +250,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'email': self._serialize.url("email", email, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + email=email, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py index e96f821a917d..30c73e2f08ab 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_notification_recipient_user_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._notification_recipient_user_operations import build_check_entity_exists_request, build_create_or_update_request, build_delete_request, build_list_by_notification_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_notification( self, resource_group_name: str, @@ -65,34 +70,24 @@ async def list_by_notification( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_notification.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_notification_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_notification.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RecipientUserCollection', pipeline_response) @@ -101,8 +96,11 @@ async def list_by_notification( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_notification.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers'} # type: ignore + + @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, @@ -131,43 +129,35 @@ async def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -196,35 +186,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -237,8 +217,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -267,38 +250,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py index 81a0ef02b5ea..dd28feaba17f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_open_id_connect_provider_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._open_id_connect_provider_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_secrets_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -67,8 +73,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenIdConnectProviderCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OpenIdConnectProviderCollection] + :return: An iterator like instance of either OpenIdConnectProviderCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.OpenIdConnectProviderCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenIdConnectProviderCollection"] @@ -76,42 +84,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OpenIdConnectProviderCollection', pipeline_response) + deserialized = self._deserialize("OpenIdConnectProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,17 +129,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -160,45 +167,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -224,46 +224,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -296,58 +290,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OpenidConnectProviderContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OpenidConnectProviderContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -380,52 +368,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OpenidConnectProviderUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OpenidConnectProviderUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -455,35 +437,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -491,6 +463,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace_async async def list_secrets( self, resource_group_name: str, @@ -516,42 +490,35 @@ async def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ClientSecretContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py index b3f376652767..26b12a2d6543 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_operation_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_operations import build_list_by_tags_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_tags( self, resource_group_name: str, @@ -78,8 +84,10 @@ def list_by_tags( :param include_not_tagged_operations: Include not tagged Operations. :type include_not_tagged_operations: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TagResourceCollection"] @@ -87,45 +95,43 @@ def list_by_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_tags.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if include_not_tagged_operations is not None: - query_parameters['includeNotTaggedOperations'] = self._serialize.query("include_not_tagged_operations", include_not_tagged_operations, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_operations=include_not_tagged_operations, + template_url=self.list_by_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_operations=include_not_tagged_operations, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,12 +144,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py new file mode 100644 index 000000000000..3bb77038b258 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_outbound_network_dependencies_endpoints_operations.py @@ -0,0 +1,97 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._outbound_network_dependencies_endpoints_operations import build_list_by_service_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OutboundNetworkDependenciesEndpointsOperations: + """OutboundNetworkDependenciesEndpointsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.apimanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def list_by_service( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.OutboundEnvironmentEndpointList": + """Gets the network endpoints of all outbound dependencies of a ApiManagement service. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundEnvironmentEndpointList, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpointList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OutboundEnvironmentEndpointList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py index 94e7ca7a0010..8e386b38f38f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_description_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._policy_description_operations import build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_service( self, resource_group_name: str, @@ -65,35 +70,24 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + scope=scope, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyDescriptionCollection', pipeline_response) @@ -102,4 +96,6 @@ async def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py index ea83cf9702e6..19d6970cc99d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_policy_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._policy_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_service( self, resource_group_name: str, @@ -62,33 +67,23 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -97,8 +92,11 @@ async def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies'} # type: ignore + + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -125,45 +123,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -192,48 +183,41 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -266,58 +250,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -347,38 +325,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py index 215ae674077b..2edb41dcf024 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_revision_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._portal_revision_operations import build_create_or_update_request_initial, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -76,8 +82,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PortalRevisionCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PortalRevisionCollection] + :return: An iterator like instance of either PortalRevisionCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PortalRevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PortalRevisionCollection"] @@ -85,42 +93,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PortalRevisionCollection', pipeline_response) + deserialized = self._deserialize("PortalRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +138,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -170,45 +177,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -235,46 +235,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -288,53 +281,46 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalRevisionContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalRevisionContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -357,15 +343,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PortalRevisionContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,31 +369,24 @@ async def begin_create_or_update( service_name=service_name, portal_revision_id=portal_revision_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -414,6 +398,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore async def _update_initial( @@ -430,54 +415,47 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalRevisionContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalRevisionContract') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -503,15 +481,20 @@ async def begin_update( :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PortalRevisionContract or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PortalRevisionContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -525,31 +508,24 @@ async def begin_update( portal_revision_id=portal_revision_id, if_match=if_match, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -561,4 +537,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py index e5ca4e2422b9..a7458f17cac5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_portal_settings_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._portal_settings_operations import build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_service( self, resource_group_name: str, @@ -62,33 +67,23 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSettingsCollection', pipeline_response) @@ -97,4 +92,6 @@ async def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py new file mode 100644 index 000000000000..0473213ccdbd --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_private_endpoint_connection_operations.py @@ -0,0 +1,517 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connection_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_by_name_request, build_get_private_link_resource_request, build_list_by_service_request, build_list_private_link_resources_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionOperations: + """PrivateEndpointConnectionOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.apimanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """Lists all private endpoint connections of the API Management service instance. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async + async def get_by_name( + self, + resource_group_name: str, + service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets the details of the Private Endpoint Connection specified by its identifier. + + :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 private_endpoint_connection_name: Name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_name_request( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + template_url=self.get_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_request: "_models.PrivateEndpointConnectionRequest", + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection_request, 'PrivateEndpointConnectionRequest') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_request: "_models.PrivateEndpointConnectionRequest", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Creates a new Private Endpoint Connection or updates an existing one. + + :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 private_endpoint_connection_name: Name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_request: + :type private_endpoint_connection_request: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_request=private_endpoint_connection_request, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Private Endpoint Connection. + + :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 private_endpoint_connection_name: Name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async + async def list_private_link_resources( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": + """Description for Gets the private link resources. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_private_link_resources_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + service_name=service_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources'} # type: ignore + + + @distributed_trace_async + async def get_private_link_resource( + self, + resource_group_name: str, + service_name: str, + private_link_sub_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": + """Description for Gets the private link resources. + + :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 private_link_sub_resource_name: Name of the private link resource. + :type private_link_sub_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_private_link_resource_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + service_name=service_name, + private_link_sub_resource_name=private_link_sub_resource_name, + template_url=self.get_private_link_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_private_link_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py index 16d30cae8942..e1a2e3dacbd6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_api_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._product_api_operations import build_check_entity_exists_request, build_create_or_update_request, build_delete_request, build_list_by_product_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_product( self, resource_group_name: str, @@ -83,43 +89,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiCollection', pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +136,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis'} # type: ignore + @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, @@ -173,43 +179,35 @@ async def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -240,35 +238,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -281,8 +269,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -313,38 +304,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py index b9ce5da9b8cd..7d3acf225e83 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_group_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._product_group_operations import build_check_entity_exists_request, build_create_or_update_request, build_delete_request, build_list_by_product_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_product( self, resource_group_name: str, @@ -71,7 +77,8 @@ def list_by_product( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupCollection"] @@ -79,43 +86,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GroupCollection', pipeline_response) + deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -128,17 +133,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups'} # type: ignore + @distributed_trace_async async def check_entity_exists( self, resource_group_name: str, @@ -169,43 +176,35 @@ async def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -236,35 +235,25 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -277,8 +266,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -309,38 +301,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py index 11743e2f40a9..2bf125cda427 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._product_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_by_tags_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -77,7 +83,8 @@ def list_by_service( :type tags: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProductCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ProductCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductCollection"] @@ -85,46 +92,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if expand_groups is not None: - query_parameters['expandGroups'] = self._serialize.query("expand_groups", expand_groups, 'bool') - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + tags=tags, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + tags=tags, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ProductCollection', pipeline_response) + deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +141,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -174,45 +180,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -239,46 +238,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -312,58 +305,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProductContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProductContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -397,52 +384,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProductUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProductUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -476,37 +457,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if delete_subscriptions is not None: - query_parameters['deleteSubscriptions'] = self._serialize.query("delete_subscriptions", delete_subscriptions, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + delete_subscriptions=delete_subscriptions, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -514,6 +484,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace def list_by_tags( self, resource_group_name: str, @@ -545,8 +517,10 @@ def list_by_tags( :param include_not_tagged_products: Include not tagged Products. :type include_not_tagged_products: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TagResourceCollection"] @@ -554,44 +528,41 @@ def list_by_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_tags.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if include_not_tagged_products is not None: - query_parameters['includeNotTaggedProducts'] = self._serialize.query("include_not_tagged_products", include_not_tagged_products, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_products=include_not_tagged_products, + template_url=self.list_by_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_products=include_not_tagged_products, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,12 +575,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py index e9f92acf8a8c..974338a15313 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_policy_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._product_policy_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_by_product_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_product( self, resource_group_name: str, @@ -66,34 +71,24 @@ async def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -102,8 +97,11 @@ async def list_by_product( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies'} # type: ignore + + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -133,46 +131,39 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -205,49 +196,42 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -284,59 +268,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -370,39 +348,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py index ff67f35c7b53..c4a9c604ebbe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_product_subscriptions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._product_subscriptions_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -77,8 +83,10 @@ def list( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] + :return: An iterator like instance of either SubscriptionCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionCollection"] @@ -86,43 +94,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionCollection', pipeline_response) + deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,12 +141,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py index e27f20796c98..2f97a108c1fa 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_counter_keys_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._quota_by_counter_keys_operations import build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_service( self, resource_group_name: str, @@ -69,34 +74,24 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterCollection', pipeline_response) @@ -105,8 +100,11 @@ async def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -139,39 +137,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterCollection', pipeline_response) @@ -180,4 +168,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py index 1d3dfb32cb84..e936bc9eaa01 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_quota_by_period_keys_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._quota_by_period_keys_operations import build_get_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,35 +77,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'quotaPeriodKey': self._serialize.url("quota_period_key", quota_period_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + quota_period_key=quota_period_key, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterContract', pipeline_response) @@ -109,8 +104,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -145,40 +143,30 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'quotaPeriodKey': self._serialize.url("quota_period_key", quota_period_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + quota_period_key=quota_period_key, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterContract', pipeline_response) @@ -187,4 +175,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py index 3688a6357097..296fee724bf7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_region_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._region_operations import build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -55,7 +61,8 @@ def list_by_service( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RegionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.RegionListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.RegionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegionListResult"] @@ -63,36 +70,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RegionListResult', pipeline_response) + deserialized = self._deserialize("RegionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +109,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py index 0b42603a8189..a847a551bacf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_reports_operations.py @@ -6,17 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._reports_operations import build_list_by_api_request, build_list_by_geo_request, build_list_by_operation_request, build_list_by_product_request, build_list_by_request_request, build_list_by_subscription_request, build_list_by_time_request, build_list_by_user_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name: str, @@ -68,7 +74,8 @@ def list_by_api( :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -76,43 +83,41 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,17 +130,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi'} # type: ignore + @distributed_trace def list_by_user( self, resource_group_name: str, @@ -174,7 +181,8 @@ def list_by_user( :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -182,43 +190,41 @@ def list_by_user( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_user.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_user_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_user.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_user_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -231,17 +237,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser'} # type: ignore + @distributed_trace def list_by_operation( self, resource_group_name: str, @@ -280,7 +288,8 @@ def list_by_operation( :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -288,43 +297,41 @@ def list_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_operation.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -337,17 +344,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation'} # type: ignore + @distributed_trace def list_by_product( self, resource_group_name: str, @@ -385,7 +394,8 @@ def list_by_product( :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -393,43 +403,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -442,17 +450,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct'} # type: ignore + @distributed_trace def list_by_geo( self, resource_group_name: str, @@ -488,7 +498,8 @@ def list_by_geo( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -496,41 +507,39 @@ def list_by_geo( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_geo.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_geo_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_geo.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_geo_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -543,17 +552,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_geo.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo'} # type: ignore + @distributed_trace def list_by_subscription( self, resource_group_name: str, @@ -591,7 +602,8 @@ def list_by_subscription( :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -599,43 +611,41 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -648,17 +658,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription'} # type: ignore + @distributed_trace def list_by_time( self, resource_group_name: str, @@ -702,7 +714,8 @@ def list_by_time( :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.ReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReportCollection"] @@ -710,44 +723,43 @@ def list_by_time( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_time.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_time_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + interval=interval, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_time.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_time_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + interval=interval, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -760,17 +772,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_time.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime'} # type: ignore + @distributed_trace def list_by_request( self, resource_group_name: str, @@ -797,8 +811,10 @@ def list_by_request( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RequestReportCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.RequestReportCollection] + :return: An iterator like instance of either RequestReportCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.RequestReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RequestReportCollection"] @@ -806,41 +822,39 @@ def list_by_request( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_request.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_request_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_request.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_request_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RequestReportCollection', pipeline_response) + deserialized = self._deserialize("RequestReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -853,12 +867,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py index 54047e9c3398..96945a7d886b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_in_settings_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sign_in_settings_operations import build_create_or_update_request, build_get_entity_tag_request, build_get_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -62,44 +67,37 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -122,45 +120,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalSigninSettings', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -190,39 +182,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSigninSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSigninSettings') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -230,6 +212,8 @@ async def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -259,40 +243,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSigninSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSigninSettings') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSigninSettings', pipeline_response) @@ -301,4 +274,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py index f2e31f389f82..c031e941ad52 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_sign_up_settings_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sign_up_settings_operations import build_create_or_update_request, build_get_entity_tag_request, build_get_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -62,44 +67,37 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -122,45 +120,39 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalSignupSettings', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -190,39 +182,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSignupSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSignupSettings') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -230,6 +212,8 @@ async def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -259,40 +243,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSignupSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSignupSettings') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSignupSettings', pipeline_response) @@ -301,4 +274,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py index 800700ea05d8..fde6b3a309fe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_subscription_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._subscription_operations import build_create_or_update_request, build_delete_request, build_get_entity_tag_request, build_get_request, build_list_request, build_list_secrets_request, build_regenerate_primary_key_request, build_regenerate_secondary_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -73,8 +79,10 @@ def list( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] + :return: An iterator like instance of either SubscriptionCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionCollection"] @@ -82,42 +90,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionCollection', pipeline_response) + deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,17 +135,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -168,45 +175,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,46 +233,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -317,62 +311,54 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SubscriptionCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SubscriptionCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + notify=notify, + if_match=if_match, + app_type=app_type, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -417,56 +403,48 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SubscriptionUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SubscriptionUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + notify=notify, + app_type=app_type, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -497,35 +475,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -533,6 +501,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace_async async def regenerate_primary_key( self, resource_group_name: str, @@ -559,34 +529,24 @@ async def regenerate_primary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_primary_key.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_primary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.regenerate_primary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -594,6 +554,8 @@ async def regenerate_primary_key( regenerate_primary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey'} # type: ignore + + @distributed_trace_async async def regenerate_secondary_key( self, resource_group_name: str, @@ -620,34 +582,24 @@ async def regenerate_secondary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_secondary_key.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_secondary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.regenerate_secondary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -655,6 +607,8 @@ async def regenerate_secondary_key( regenerate_secondary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey'} # type: ignore + + @distributed_trace_async async def list_secrets( self, resource_group_name: str, @@ -681,42 +635,35 @@ async def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionKeysContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py index 8cae2be48bdf..6ce8464870fe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tag_operations import build_assign_to_api_request, build_assign_to_operation_request, build_assign_to_product_request, build_create_or_update_request, build_delete_request, build_detach_from_api_request, build_detach_from_operation_request, build_detach_from_product_request, build_get_by_api_request, build_get_by_operation_request, build_get_by_product_request, build_get_entity_state_by_api_request, build_get_entity_state_by_operation_request, build_get_entity_state_by_product_request, build_get_entity_state_request, build_get_request, build_list_by_api_request, build_list_by_operation_request, build_list_by_product_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_operation( self, resource_group_name: str, @@ -83,44 +89,43 @@ def list_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +138,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags'} # type: ignore + @distributed_trace_async async def get_entity_state_by_operation( self, resource_group_name: str, @@ -177,47 +184,40 @@ async def get_entity_state_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def get_by_operation( self, resource_group_name: str, @@ -251,48 +251,42 @@ async def get_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def assign_to_operation( self, resource_group_name: str, @@ -326,36 +320,26 @@ async def assign_to_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.assign_to_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_assign_to_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.assign_to_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -368,8 +352,11 @@ async def assign_to_operation( return cls(pipeline_response, deserialized, {}) return deserialized + assign_to_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def detach_from_operation( self, resource_group_name: str, @@ -403,36 +390,26 @@ async def detach_from_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.detach_from_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_detach_from_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.detach_from_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -440,6 +417,8 @@ async def detach_from_operation( detach_from_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace def list_by_api( self, resource_group_name: str, @@ -478,43 +457,41 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -527,17 +504,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags'} # type: ignore + @distributed_trace_async async def get_entity_state_by_api( self, resource_group_name: str, @@ -567,46 +546,39 @@ async def get_entity_state_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def get_by_api( self, resource_group_name: str, @@ -636,47 +608,41 @@ async def get_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def assign_to_api( self, resource_group_name: str, @@ -706,52 +672,47 @@ async def assign_to_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.assign_to_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_assign_to_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.assign_to_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + assign_to_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def detach_from_api( self, resource_group_name: str, @@ -781,35 +742,25 @@ async def detach_from_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.detach_from_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_detach_from_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.detach_from_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -817,6 +768,8 @@ async def detach_from_api( detach_from_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace def list_by_product( self, resource_group_name: str, @@ -855,43 +808,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -904,17 +855,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags'} # type: ignore + @distributed_trace_async async def get_entity_state_by_product( self, resource_group_name: str, @@ -944,46 +897,39 @@ async def get_entity_state_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def get_by_product( self, resource_group_name: str, @@ -1013,47 +959,41 @@ async def get_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def assign_to_product( self, resource_group_name: str, @@ -1083,35 +1023,25 @@ async def assign_to_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.assign_to_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_assign_to_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.assign_to_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1124,8 +1054,11 @@ async def assign_to_product( return cls(pipeline_response, deserialized, {}) return deserialized + assign_to_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def detach_from_product( self, resource_group_name: str, @@ -1155,35 +1088,25 @@ async def detach_from_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.detach_from_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_detach_from_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.detach_from_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1191,6 +1114,8 @@ async def detach_from_product( detach_from_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -1229,44 +1154,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + scope=scope, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + scope=scope, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1279,17 +1201,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags'} # type: ignore + @distributed_trace_async async def get_entity_state( self, resource_group_name: str, @@ -1315,45 +1239,38 @@ async def get_entity_state( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -1379,46 +1296,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -1451,58 +1362,52 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagCreateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagCreateUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -1535,52 +1440,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagCreateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagCreateUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -1610,38 +1509,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py index 9331ecb08025..c6866a663dc9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tag_resource_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tag_resource_operations import build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -77,8 +83,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TagResourceCollection"] @@ -86,42 +94,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -134,12 +139,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py index 8dc6e6238564..bbc2cecfa072 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_git_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tenant_access_git_operations import build_regenerate_primary_key_request, build_regenerate_secondary_key_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def regenerate_primary_key( self, resource_group_name: str, @@ -65,34 +70,24 @@ async def regenerate_primary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_primary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_regenerate_primary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_primary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -100,6 +95,8 @@ async def regenerate_primary_key( regenerate_primary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey'} # type: ignore + + @distributed_trace_async async def regenerate_secondary_key( self, resource_group_name: str, @@ -125,37 +122,28 @@ async def regenerate_secondary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_secondary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_secondary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_secondary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) regenerate_secondary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py index 2e00b8c9a500..e46996010bcc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_access_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tenant_access_operations import build_create_request, build_get_entity_tag_request, build_get_request, build_list_by_service_request, build_list_secrets_request, build_regenerate_primary_key_request, build_regenerate_secondary_key_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_service( :param filter: Not used. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccessInformationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AccessInformationCollection] + :return: An iterator like instance of either AccessInformationCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.AccessInformationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessInformationCollection"] @@ -66,38 +74,35 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AccessInformationCollection', pipeline_response) + deserialized = self._deserialize("AccessInformationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +115,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -146,45 +153,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -210,46 +210,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -282,52 +276,46 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - 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])?$'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessInformationCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessInformationCreateParameters') + + request = build_create_request( + resource_group_name=resource_group_name, + service_name=service_name, + access_name=access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -360,52 +348,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessInformationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessInformationUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + access_name=access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace_async async def regenerate_primary_key( self, resource_group_name: str, @@ -431,34 +413,24 @@ async def regenerate_primary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_primary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_primary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_primary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -466,6 +438,8 @@ async def regenerate_primary_key( regenerate_primary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey'} # type: ignore + + @distributed_trace_async async def regenerate_secondary_key( self, resource_group_name: str, @@ -491,34 +465,24 @@ async def regenerate_secondary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_secondary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_secondary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_secondary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -526,6 +490,8 @@ async def regenerate_secondary_key( regenerate_secondary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey'} # type: ignore + + @distributed_trace_async async def list_secrets( self, resource_group_name: str, @@ -551,42 +517,35 @@ async def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationSecretsContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py index d7ba3324e1d4..bd6a5ee2f972 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_configuration_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tenant_configuration_operations import build_deploy_request_initial, build_get_sync_state_request, build_save_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,40 +59,29 @@ async def _deploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._deploy_initial.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DeployConfigurationParameters') + + request = build_deploy_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._deploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DeployConfigurationParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -98,8 +91,11 @@ async def _deploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy'} # type: ignore + + @distributed_trace_async async def begin_deploy( self, resource_group_name: str, @@ -121,15 +117,20 @@ async def begin_deploy( :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationResultContract or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -142,28 +143,21 @@ async def begin_deploy( service_name=service_name, configuration_name=configuration_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResultContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -175,6 +169,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy'} # type: ignore async def _save_initial( @@ -190,40 +185,29 @@ async def _save_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._save_initial.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SaveConfigurationParameter') + + request = build_save_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._save_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SaveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -233,8 +217,11 @@ async def _save_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _save_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save'} # type: ignore + + @distributed_trace_async async def begin_save( self, resource_group_name: str, @@ -256,15 +243,20 @@ async def begin_save( :type parameters: ~azure.mgmt.apimanagement.models.SaveConfigurationParameter :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationResultContract or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -277,28 +269,21 @@ async def begin_save( service_name=service_name, configuration_name=configuration_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResultContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -310,6 +295,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_save.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save'} # type: ignore async def _validate_initial( @@ -325,40 +311,29 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DeployConfigurationParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_validate_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DeployConfigurationParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -368,8 +343,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate'} # type: ignore + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -391,15 +369,20 @@ async def begin_validate( :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationResultContract or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationResultContract or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -412,28 +395,21 @@ async def begin_validate( service_name=service_name, configuration_name=configuration_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResultContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -445,8 +421,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate'} # type: ignore + @distributed_trace_async async def get_sync_state( self, resource_group_name: str, @@ -473,34 +451,24 @@ async def get_sync_state( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_sync_state.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_sync_state_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + template_url=self.get_sync_state.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TenantConfigurationSyncStateContract', pipeline_response) @@ -509,4 +477,6 @@ async def get_sync_state( return cls(pipeline_response, deserialized, {}) return deserialized + get_sync_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py index 6e0cd8cd4ee9..6a124c211e1c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_tenant_settings_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._tenant_settings_operations import build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_service( :param filter: Not used. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TenantSettingsCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TenantSettingsCollection] + :return: An iterator like instance of either TenantSettingsCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.TenantSettingsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantSettingsCollection"] @@ -66,38 +74,35 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TenantSettingsCollection', pipeline_response) + deserialized = self._deserialize("TenantSettingsCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +115,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,42 +153,35 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'settingsType': self._serialize.url("settings_type", settings_type, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + settings_type=settings_type, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TenantSettingsContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py index 79a758b705b9..5a2f963d9f75 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_confirmation_password_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_confirmation_password_operations import build_send_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def send( self, resource_group_name: str, @@ -69,39 +74,29 @@ async def send( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.send.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') + + request = build_send_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + app_type=app_type, + template_url=self.send.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) send.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py index 1f67b6ed4dba..cc858d71458c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_group_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_group_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -73,7 +79,8 @@ def list( :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GroupCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.GroupCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupCollection"] @@ -81,43 +88,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GroupCollection', pipeline_response) + deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,12 +135,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py index fea02ac5029d..b20a5c8f302b 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_identities_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_identities_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param user_id: User identifier. Must be unique in the current API Management service instance. :type user_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UserIdentityCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserIdentityCollection] + :return: An iterator like instance of either UserIdentityCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserIdentityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserIdentityCollection"] @@ -66,37 +74,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserIdentityCollection', pipeline_response) + deserialized = self._deserialize("UserIdentityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,12 +115,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py index c1c00e2ad76e..c28f4b859241 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_operations import build_create_or_update_request, build_delete_request, build_generate_sso_url_request, build_get_entity_tag_request, build_get_request, build_get_shared_access_token_request, build_list_by_service_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -75,7 +81,8 @@ def list_by_service( :type expand_groups: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.UserCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserCollection"] @@ -83,44 +90,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if expand_groups is not None: - query_parameters['expandGroups'] = self._serialize.query("expand_groups", expand_groups, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('UserCollection', pipeline_response) + deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +137,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users'} # type: ignore + @distributed_trace_async async def get_entity_tag( self, resource_group_name: str, @@ -169,45 +175,38 @@ async def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -233,46 +232,40 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -308,60 +301,53 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UserCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UserCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + notify=notify, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -394,52 +380,46 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UserUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UserUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -479,41 +459,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if delete_subscriptions is not None: - query_parameters['deleteSubscriptions'] = self._serialize.query("delete_subscriptions", delete_subscriptions, 'bool') - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) + + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + delete_subscriptions=delete_subscriptions, + notify=notify, + app_type=app_type, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -521,6 +488,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace_async async def generate_sso_url( self, resource_group_name: str, @@ -547,34 +516,24 @@ async def generate_sso_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.generate_sso_url.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_sso_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.generate_sso_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GenerateSsoUrlResult', pipeline_response) @@ -583,8 +542,11 @@ async def generate_sso_url( return cls(pipeline_response, deserialized, {}) return deserialized + generate_sso_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl'} # type: ignore + + @distributed_trace_async async def get_shared_access_token( self, resource_group_name: str, @@ -613,39 +575,29 @@ async def get_shared_access_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_shared_access_token.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UserTokenParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_get_shared_access_token_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.get_shared_access_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UserTokenParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserTokenResult', pipeline_response) @@ -654,4 +606,6 @@ async def get_shared_access_token( return cls(pipeline_response, deserialized, {}) return deserialized + get_shared_access_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py index 772fbc8c9a6e..eec3dc668d65 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/aio/operations/_user_subscription_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_subscription_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -75,8 +81,10 @@ def list( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] + :return: An iterator like instance of either SubscriptionCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionCollection"] @@ -84,43 +92,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionCollection', pipeline_response) + deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +139,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -173,43 +181,36 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_id, 'str', max_length=80, min_length=1), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}'} # type: ignore + 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 e329c40fad4e..cbcf70eac0a9 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 @@ -14,6 +14,7 @@ from ._models_py3 import AccessInformationUpdateParameters from ._models_py3 import AdditionalLocation from ._models_py3 import ApiCollection + from ._models_py3 import ApiContactInformation from ._models_py3 import ApiContract from ._models_py3 import ApiContractProperties from ._models_py3 import ApiContractUpdateProperties @@ -23,6 +24,7 @@ from ._models_py3 import ApiEntityBaseContract from ._models_py3 import ApiExportResult from ._models_py3 import ApiExportResultValue + from ._models_py3 import ApiLicenseInformation from ._models_py3 import ApiManagementServiceApplyNetworkConfigurationParameters from ._models_py3 import ApiManagementServiceBackupRestoreParameters from ._models_py3 import ApiManagementServiceBaseProperties @@ -62,6 +64,7 @@ from ._models_py3 import ApiVersionSetUpdateParameters from ._models_py3 import ApiVersionSetUpdateParametersProperties from ._models_py3 import ApimResource + from ._models_py3 import ArmIdWrapper from ._models_py3 import AssociationContract from ._models_py3 import AuthenticationSettingsContract from ._models_py3 import AuthorizationServerCollection @@ -94,6 +97,14 @@ from ._models_py3 import CertificateCreateOrUpdateParameters from ._models_py3 import CertificateInformation from ._models_py3 import ClientSecretContract + from ._models_py3 import ConnectivityCheckRequest + from ._models_py3 import ConnectivityCheckRequestDestination + from ._models_py3 import ConnectivityCheckRequestProtocolConfiguration + from ._models_py3 import ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration + from ._models_py3 import ConnectivityCheckRequestSource + from ._models_py3 import ConnectivityCheckResponse + from ._models_py3 import ConnectivityHop + from ._models_py3 import ConnectivityIssue from ._models_py3 import ConnectivityStatusContract from ._models_py3 import ContentItemCollection from ._models_py3 import ContentItemContract @@ -110,6 +121,8 @@ from ._models_py3 import EmailTemplateContract from ._models_py3 import EmailTemplateParametersContractProperties from ._models_py3 import EmailTemplateUpdateParameters + from ._models_py3 import EndpointDependency + from ._models_py3 import EndpointDetail from ._models_py3 import ErrorFieldContract from ._models_py3 import ErrorResponse from ._models_py3 import ErrorResponseBody @@ -124,11 +137,14 @@ from ._models_py3 import GatewayTokenContract from ._models_py3 import GatewayTokenRequestContract from ._models_py3 import GenerateSsoUrlResult + from ._models_py3 import GlobalSchemaCollection + from ._models_py3 import GlobalSchemaContract from ._models_py3 import GroupCollection from ._models_py3 import GroupContract from ._models_py3 import GroupContractProperties from ._models_py3 import GroupCreateParameters from ._models_py3 import GroupUpdateParameters + from ._models_py3 import HTTPHeader from ._models_py3 import HostnameConfiguration from ._models_py3 import HttpMessageDiagnostic from ._models_py3 import IdentityProviderBaseParameters @@ -185,7 +201,10 @@ from ._models_py3 import OperationTagResourceContractProperties from ._models_py3 import OperationUpdateContract from ._models_py3 import OperationUpdateContractProperties + from ._models_py3 import OutboundEnvironmentEndpoint + from ._models_py3 import OutboundEnvironmentEndpointList from ._models_py3 import ParameterContract + from ._models_py3 import ParameterExampleContract from ._models_py3 import PipelineDiagnosticSettings from ._models_py3 import PolicyCollection from ._models_py3 import PolicyContract @@ -199,6 +218,14 @@ from ._models_py3 import PortalSettingsContract from ._models_py3 import PortalSigninSettings from ._models_py3 import PortalSignupSettings + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateEndpointConnectionRequest + from ._models_py3 import PrivateEndpointConnectionRequestProperties + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProductCollection from ._models_py3 import ProductContract from ._models_py3 import ProductContractProperties @@ -219,6 +246,7 @@ from ._models_py3 import RegionContract from ._models_py3 import RegionListResult from ._models_py3 import RegistrationDelegationSettingsProperties + from ._models_py3 import RemotePrivateEndpointConnectionWrapper from ._models_py3 import ReportCollection from ._models_py3 import ReportRecordContract from ._models_py3 import RepresentationContract @@ -243,6 +271,7 @@ from ._models_py3 import SubscriptionKeysContract from ._models_py3 import SubscriptionUpdateParameters from ._models_py3 import SubscriptionsDelegationSettingsProperties + from ._models_py3 import SystemData from ._models_py3 import TagCollection from ._models_py3 import TagContract from ._models_py3 import TagCreateUpdateParameters @@ -282,6 +311,7 @@ from ._models import AccessInformationUpdateParameters # type: ignore from ._models import AdditionalLocation # type: ignore from ._models import ApiCollection # type: ignore + from ._models import ApiContactInformation # type: ignore from ._models import ApiContract # type: ignore from ._models import ApiContractProperties # type: ignore from ._models import ApiContractUpdateProperties # type: ignore @@ -291,6 +321,7 @@ from ._models import ApiEntityBaseContract # type: ignore from ._models import ApiExportResult # type: ignore from ._models import ApiExportResultValue # type: ignore + from ._models import ApiLicenseInformation # type: ignore from ._models import ApiManagementServiceApplyNetworkConfigurationParameters # type: ignore from ._models import ApiManagementServiceBackupRestoreParameters # type: ignore from ._models import ApiManagementServiceBaseProperties # type: ignore @@ -330,6 +361,7 @@ from ._models import ApiVersionSetUpdateParameters # type: ignore from ._models import ApiVersionSetUpdateParametersProperties # type: ignore from ._models import ApimResource # type: ignore + from ._models import ArmIdWrapper # type: ignore from ._models import AssociationContract # type: ignore from ._models import AuthenticationSettingsContract # type: ignore from ._models import AuthorizationServerCollection # type: ignore @@ -362,6 +394,14 @@ from ._models import CertificateCreateOrUpdateParameters # type: ignore from ._models import CertificateInformation # type: ignore from ._models import ClientSecretContract # type: ignore + from ._models import ConnectivityCheckRequest # type: ignore + from ._models import ConnectivityCheckRequestDestination # type: ignore + from ._models import ConnectivityCheckRequestProtocolConfiguration # type: ignore + from ._models import ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration # type: ignore + from ._models import ConnectivityCheckRequestSource # type: ignore + from ._models import ConnectivityCheckResponse # type: ignore + from ._models import ConnectivityHop # type: ignore + from ._models import ConnectivityIssue # type: ignore from ._models import ConnectivityStatusContract # type: ignore from ._models import ContentItemCollection # type: ignore from ._models import ContentItemContract # type: ignore @@ -378,6 +418,8 @@ from ._models import EmailTemplateContract # type: ignore from ._models import EmailTemplateParametersContractProperties # type: ignore from ._models import EmailTemplateUpdateParameters # type: ignore + from ._models import EndpointDependency # type: ignore + from ._models import EndpointDetail # type: ignore from ._models import ErrorFieldContract # type: ignore from ._models import ErrorResponse # type: ignore from ._models import ErrorResponseBody # type: ignore @@ -392,11 +434,14 @@ from ._models import GatewayTokenContract # type: ignore from ._models import GatewayTokenRequestContract # type: ignore from ._models import GenerateSsoUrlResult # type: ignore + from ._models import GlobalSchemaCollection # type: ignore + from ._models import GlobalSchemaContract # type: ignore from ._models import GroupCollection # type: ignore from ._models import GroupContract # type: ignore from ._models import GroupContractProperties # type: ignore from ._models import GroupCreateParameters # type: ignore from ._models import GroupUpdateParameters # type: ignore + from ._models import HTTPHeader # type: ignore from ._models import HostnameConfiguration # type: ignore from ._models import HttpMessageDiagnostic # type: ignore from ._models import IdentityProviderBaseParameters # type: ignore @@ -453,7 +498,10 @@ from ._models import OperationTagResourceContractProperties # type: ignore from ._models import OperationUpdateContract # type: ignore from ._models import OperationUpdateContractProperties # type: ignore + from ._models import OutboundEnvironmentEndpoint # type: ignore + from ._models import OutboundEnvironmentEndpointList # type: ignore from ._models import ParameterContract # type: ignore + from ._models import ParameterExampleContract # type: ignore from ._models import PipelineDiagnosticSettings # type: ignore from ._models import PolicyCollection # type: ignore from ._models import PolicyContract # type: ignore @@ -467,6 +515,14 @@ from ._models import PortalSettingsContract # type: ignore from ._models import PortalSigninSettings # type: ignore from ._models import PortalSignupSettings # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateEndpointConnectionRequest # type: ignore + from ._models import PrivateEndpointConnectionRequestProperties # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore from ._models import ProductCollection # type: ignore from ._models import ProductContract # type: ignore from ._models import ProductContractProperties # type: ignore @@ -487,6 +543,7 @@ from ._models import RegionContract # type: ignore from ._models import RegionListResult # type: ignore from ._models import RegistrationDelegationSettingsProperties # type: ignore + from ._models import RemotePrivateEndpointConnectionWrapper # type: ignore from ._models import ReportCollection # type: ignore from ._models import ReportRecordContract # type: ignore from ._models import RepresentationContract # type: ignore @@ -511,6 +568,7 @@ from ._models import SubscriptionKeysContract # type: ignore from ._models import SubscriptionUpdateParameters # type: ignore from ._models import SubscriptionsDelegationSettingsProperties # type: ignore + from ._models import SystemData # type: ignore from ._models import TagCollection # type: ignore from ._models import TagContract # type: ignore from ._models import TagCreateUpdateParameters # type: ignore @@ -545,6 +603,7 @@ from ._api_management_client_enums import ( AccessIdName, + AccessType, AlwaysLog, ApiManagementSkuCapacityScaleType, ApiManagementSkuRestrictionsReasonCode, @@ -559,11 +618,16 @@ BearerTokenSendingMethod, BearerTokenSendingMethods, CertificateConfigurationStoreName, + CertificateSource, + CertificateStatus, ClientAuthenticationMethod, ConfigurationIdName, Confirmation, + ConnectionStatus, + ConnectivityCheckProtocol, ConnectivityStatusType, ContentFormat, + CreatedByType, DataMaskingMode, ExportApi, ExportFormat, @@ -573,21 +637,31 @@ HostnameType, HttpCorrelationProtocol, IdentityProviderType, + IssueType, KeyType, LoggerType, + Method, NameAvailabilityReason, NotificationName, OperationNameFormat, + Origin, + PlatformVersion, PolicyContentFormat, PolicyExportFormat, PolicyIdName, PolicyScopeContract, PortalRevisionStatus, + PreferredIPVersion, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, ProductState, Protocol, + PublicNetworkAccess, ResourceSkuCapacityScaleType, SamplingType, + SchemaType, SettingsTypeName, + Severity, SkuType, SoapApiType, State, @@ -607,6 +681,7 @@ 'AccessInformationUpdateParameters', 'AdditionalLocation', 'ApiCollection', + 'ApiContactInformation', 'ApiContract', 'ApiContractProperties', 'ApiContractUpdateProperties', @@ -616,6 +691,7 @@ 'ApiEntityBaseContract', 'ApiExportResult', 'ApiExportResultValue', + 'ApiLicenseInformation', 'ApiManagementServiceApplyNetworkConfigurationParameters', 'ApiManagementServiceBackupRestoreParameters', 'ApiManagementServiceBaseProperties', @@ -655,6 +731,7 @@ 'ApiVersionSetUpdateParameters', 'ApiVersionSetUpdateParametersProperties', 'ApimResource', + 'ArmIdWrapper', 'AssociationContract', 'AuthenticationSettingsContract', 'AuthorizationServerCollection', @@ -687,6 +764,14 @@ 'CertificateCreateOrUpdateParameters', 'CertificateInformation', 'ClientSecretContract', + 'ConnectivityCheckRequest', + 'ConnectivityCheckRequestDestination', + 'ConnectivityCheckRequestProtocolConfiguration', + 'ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration', + 'ConnectivityCheckRequestSource', + 'ConnectivityCheckResponse', + 'ConnectivityHop', + 'ConnectivityIssue', 'ConnectivityStatusContract', 'ContentItemCollection', 'ContentItemContract', @@ -703,6 +788,8 @@ 'EmailTemplateContract', 'EmailTemplateParametersContractProperties', 'EmailTemplateUpdateParameters', + 'EndpointDependency', + 'EndpointDetail', 'ErrorFieldContract', 'ErrorResponse', 'ErrorResponseBody', @@ -717,11 +804,14 @@ 'GatewayTokenContract', 'GatewayTokenRequestContract', 'GenerateSsoUrlResult', + 'GlobalSchemaCollection', + 'GlobalSchemaContract', 'GroupCollection', 'GroupContract', 'GroupContractProperties', 'GroupCreateParameters', 'GroupUpdateParameters', + 'HTTPHeader', 'HostnameConfiguration', 'HttpMessageDiagnostic', 'IdentityProviderBaseParameters', @@ -778,7 +868,10 @@ 'OperationTagResourceContractProperties', 'OperationUpdateContract', 'OperationUpdateContractProperties', + 'OutboundEnvironmentEndpoint', + 'OutboundEnvironmentEndpointList', 'ParameterContract', + 'ParameterExampleContract', 'PipelineDiagnosticSettings', 'PolicyCollection', 'PolicyContract', @@ -792,6 +885,14 @@ 'PortalSettingsContract', 'PortalSigninSettings', 'PortalSignupSettings', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateEndpointConnectionRequest', + 'PrivateEndpointConnectionRequestProperties', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', 'ProductCollection', 'ProductContract', 'ProductContractProperties', @@ -812,6 +913,7 @@ 'RegionContract', 'RegionListResult', 'RegistrationDelegationSettingsProperties', + 'RemotePrivateEndpointConnectionWrapper', 'ReportCollection', 'ReportRecordContract', 'RepresentationContract', @@ -836,6 +938,7 @@ 'SubscriptionKeysContract', 'SubscriptionUpdateParameters', 'SubscriptionsDelegationSettingsProperties', + 'SystemData', 'TagCollection', 'TagContract', 'TagCreateUpdateParameters', @@ -868,6 +971,7 @@ 'VirtualNetworkConfiguration', 'X509CertificateName', 'AccessIdName', + 'AccessType', 'AlwaysLog', 'ApiManagementSkuCapacityScaleType', 'ApiManagementSkuRestrictionsReasonCode', @@ -882,11 +986,16 @@ 'BearerTokenSendingMethod', 'BearerTokenSendingMethods', 'CertificateConfigurationStoreName', + 'CertificateSource', + 'CertificateStatus', 'ClientAuthenticationMethod', 'ConfigurationIdName', 'Confirmation', + 'ConnectionStatus', + 'ConnectivityCheckProtocol', 'ConnectivityStatusType', 'ContentFormat', + 'CreatedByType', 'DataMaskingMode', 'ExportApi', 'ExportFormat', @@ -896,21 +1005,31 @@ 'HostnameType', 'HttpCorrelationProtocol', 'IdentityProviderType', + 'IssueType', 'KeyType', 'LoggerType', + 'Method', 'NameAvailabilityReason', 'NotificationName', 'OperationNameFormat', + 'Origin', + 'PlatformVersion', 'PolicyContentFormat', 'PolicyExportFormat', 'PolicyIdName', 'PolicyScopeContract', 'PortalRevisionStatus', + 'PreferredIPVersion', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', 'ProductState', 'Protocol', + 'PublicNetworkAccess', 'ResourceSkuCapacityScaleType', 'SamplingType', + 'SchemaType', 'SettingsTypeName', + 'Severity', 'SkuType', 'SoapApiType', 'State', 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 796a886a4a17..b194dd14e518 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 @@ -6,39 +6,35 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessIdName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessIdName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCESS = "access" GIT_ACCESS = "gitAccess" -class AlwaysLog(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of access to be used for the storage account. + """ + + #: Use access key. + ACCESS_KEY = "AccessKey" + #: Use system assigned managed identity. + SYSTEM_ASSIGNED_MANAGED_IDENTITY = "SystemAssignedManagedIdentity" + #: Use user assigned managed identity. + USER_ASSIGNED_MANAGED_IDENTITY = "UserAssignedManagedIdentity" + +class AlwaysLog(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies for what type of messages sampling settings should not apply. """ #: Always log all erroneous request regardless of sampling settings. ALL_ERRORS = "allErrors" -class ApiManagementSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApiManagementSkuCapacityScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -46,21 +42,21 @@ class ApiManagementSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, MANUAL = "Manual" NONE = "None" -class ApiManagementSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApiManagementSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for restriction. """ QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ApiManagementSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApiManagementSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of restrictions. """ LOCATION = "Location" ZONE = "Zone" -class ApimIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApimIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. @@ -71,14 +67,16 @@ class ApimIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class ApiType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApiType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of API. """ HTTP = "http" SOAP = "soap" + WEBSOCKET = "websocket" + GRAPHQL = "graphql" -class ApiVersionSetContractDetailsVersioningScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApiVersionSetContractDetailsVersioningScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """An value that determines where the API Version identifier will be located in a HTTP request. """ @@ -86,14 +84,14 @@ class ApiVersionSetContractDetailsVersioningScheme(with_metaclass(_CaseInsensiti QUERY = "Query" HEADER = "Header" -class AppType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User create request was sent by legacy developer portal. PORTAL = "portal" #: User create request was sent by new developer portal. DEVELOPER_PORTAL = "developerPortal" -class AsyncOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AsyncOperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of an async operation. """ @@ -102,7 +100,7 @@ class AsyncOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" FAILED = "Failed" -class AuthorizationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthorizationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HEAD = "HEAD" OPTIONS = "OPTIONS" @@ -113,7 +111,7 @@ class AuthorizationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PATCH = "PATCH" DELETE = "DELETE" -class BackendProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BackendProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Backend communication protocol. """ @@ -122,12 +120,12 @@ class BackendProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The Backend is a SOAP service. SOAP = "soap" -class BearerTokenSendingMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BearerTokenSendingMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AUTHORIZATION_HEADER = "authorizationHeader" QUERY = "query" -class BearerTokenSendingMethods(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BearerTokenSendingMethods(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Form of an authorization grant, which the client uses to request the access token. """ @@ -136,7 +134,7 @@ class BearerTokenSendingMethods(with_metaclass(_CaseInsensitiveEnumMeta, str, En #: Access token will be transmitted as query parameters. QUERY = "query" -class CertificateConfigurationStoreName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateConfigurationStoreName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. """ @@ -144,18 +142,35 @@ class CertificateConfigurationStoreName(with_metaclass(_CaseInsensitiveEnumMeta, CERTIFICATE_AUTHORITY = "CertificateAuthority" ROOT = "Root" -class ClientAuthenticationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificateSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Certificate Source. + """ + + MANAGED = "Managed" + KEY_VAULT = "KeyVault" + CUSTOM = "Custom" + BUILT_IN = "BuiltIn" + +class CertificateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Certificate Status. + """ + + COMPLETED = "Completed" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + +class ClientAuthenticationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Basic Client Authentication method. BASIC = "Basic" #: Body based Authentication method. BODY = "Body" -class ConfigurationIdName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigurationIdName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CONFIGURATION = "configuration" -class Confirmation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Confirmation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines the type of confirmation e-mail that will be sent to the newly created user. """ @@ -164,7 +179,25 @@ class Confirmation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Send an e-mail inviting the user to sign-up and complete registration. INVITE = "invite" -class ConnectivityStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The connection status. + """ + + UNKNOWN = "Unknown" + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + DEGRADED = "Degraded" + +class ConnectivityCheckProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The request's protocol. Specific protocol configuration can be available based on this + selection. The specified destination address must be coherent with this value. + """ + + TCP = "TCP" + HTTP = "HTTP" + HTTPS = "HTTPS" + +class ConnectivityStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource Connectivity Status Type identifier. """ @@ -172,7 +205,7 @@ class ConnectivityStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCESS = "success" FAILURE = "failure" -class ContentFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ContentFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Format of the Content in which the API is getting imported. """ @@ -196,8 +229,19 @@ class ContentFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OPENAPI_LINK = "openapi-link" #: The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet address. OPENAPI_JSON_LINK = "openapi+json-link" + #: The GraphQL API endpoint hosted on a publicly accessible internet address. + GRAPHQL_LINK = "graphql-link" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" -class DataMaskingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataMaskingMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Data masking mode. """ @@ -206,11 +250,11 @@ class DataMaskingMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Hide the presence of an entity. HIDE = "Hide" -class ExportApi(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExportApi(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TRUE = "true" -class ExportFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExportFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Export the Api Definition in OpenAPI 2.0 Specification as JSON document to the Storage Blob. SWAGGER = "swagger-link" @@ -224,22 +268,22 @@ class ExportFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Export the Api Definition in OpenAPI 3.0 Specification as JSON document to Storage Blob. OPENAPI_JSON = "openapi+json-link" -class ExportResultFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Format in which the Api Details are exported to the Storage Blob with Sas Key valid for 5 +class ExportResultFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Format in which the API Details are exported to the Storage Blob with Sas Key valid for 5 minutes. """ - #: The Api Definition is exported in OpenApi Specification 2.0 format to the Storage Blob. + #: The API Definition is exported in OpenAPI Specification 2.0 format to the Storage Blob. SWAGGER = "swagger-link-json" - #: The Api Definition is exported in WSDL Schema to Storage Blob. This is only supported for APIs + #: The API Definition is exported in WSDL Schema to Storage Blob. This is only supported for APIs #: of Type ``soap``. WSDL = "wsdl-link+xml" - #: Export the Api Definition in WADL Schema to Storage Blob. + #: Export the API Definition in WADL Schema to Storage Blob. WADL = "wadl-link-json" - #: Export the Api Definition in OpenApi Specification 3.0 to Storage Blob. + #: Export the API Definition in OpenAPI Specification 3.0 to Storage Blob. OPEN_API = "openapi-link" -class GrantType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GrantType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Authorization Code Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.1. AUTHORIZATION_CODE = "authorizationCode" @@ -251,7 +295,7 @@ class GrantType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Client Credentials Grant flow as described https://tools.ietf.org/html/rfc6749#section-4.4. CLIENT_CREDENTIALS = "clientCredentials" -class GroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GroupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Group type. """ @@ -259,7 +303,7 @@ class GroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" EXTERNAL = "external" -class HostnameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostnameType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Hostname type. """ @@ -269,7 +313,7 @@ class HostnameType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SCM = "Scm" DEVELOPER_PORTAL = "DeveloperPortal" -class HttpCorrelationProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HttpCorrelationProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sets correlation protocol to use for Application Insights diagnostics. """ @@ -281,7 +325,7 @@ class HttpCorrelationProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Inject Trace Context headers. See https://w3c.github.io/trace-context. W3_C = "W3C" -class IdentityProviderType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityProviderType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Facebook as Identity provider. FACEBOOK = "facebook" @@ -296,14 +340,28 @@ class IdentityProviderType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Azure Active Directory B2C as Identity provider. AAD_B2_C = "aadB2C" -class KeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IssueType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of issue. + """ + + UNKNOWN = "Unknown" + AGENT_STOPPED = "AgentStopped" + GUEST_FIREWALL = "GuestFirewall" + DNS_RESOLUTION = "DnsResolution" + SOCKET_BIND = "SocketBind" + NETWORK_SECURITY_RULE = "NetworkSecurityRule" + USER_DEFINED_ROUTE = "UserDefinedRoute" + PORT_THROTTLED = "PortThrottled" + PLATFORM = "Platform" + +class KeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Key to be used to generate token for user. """ PRIMARY = "primary" SECONDARY = "secondary" -class LoggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LoggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Logger type. """ @@ -314,7 +372,14 @@ class LoggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Azure Monitor. AZURE_MONITOR = "azureMonitor" -class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Method(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The HTTP method to be used. + """ + + GET = "GET" + POST = "POST" + +class NameAvailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Invalid indicates the name provided does not match the resource provider’s naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the name is already in use and is therefore unavailable. @@ -324,7 +389,7 @@ class NameAvailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class NotificationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The following email recipients and users will receive email notifications about subscription #: requests for API products requiring approval. @@ -347,7 +412,7 @@ class NotificationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: usage gets close to usage quota. QUOTA_LIMIT_APPROACHING_PUBLISHER_NOTIFICATION_MESSAGE = "QuotaLimitApproachingPublisherNotificationMessage" -class OperationNameFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationNameFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The format of the Operation Name for Application Insights telemetries. Default is Name. """ @@ -356,7 +421,28 @@ class OperationNameFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: HTTP_VERB URL. URL = "Url" -class PolicyContentFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The origin of the issue. + """ + + LOCAL = "Local" + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class PlatformVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Compute Platform Version running the service. + """ + + #: Platform version cannot be determined, as compute platform is not deployed. + UNDETERMINED = "undetermined" + #: Platform running the service on Single Tenant V1 platform. + STV1 = "stv1" + #: Platform running the service on Single Tenant V2 platform. + STV2 = "stv2" + #: Platform running the service on Multi Tenant V1 platform. + MTV1 = "mtv1" + +class PolicyContentFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Format of the policyContent. """ @@ -371,18 +457,18 @@ class PolicyContentFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Management service. RAWXML_LINK = "rawxml-link" -class PolicyExportFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyExportFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The contents are inline and Content type is an XML document. XML = "xml" #: The contents are inline and Content type is a non XML encoded policy document. RAWXML = "rawxml" -class PolicyIdName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyIdName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): POLICY = "policy" -class PolicyScopeContract(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PolicyScopeContract(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TENANT = "Tenant" PRODUCT = "Product" @@ -390,20 +476,43 @@ class PolicyScopeContract(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): OPERATION = "Operation" ALL = "All" -class PortalRevisionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Portal revision publishing status +class PortalRevisionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Status of the portal's revision. """ - #: Portal revision publishing is pending. + #: Portal's revision has been queued. PENDING = "pending" - #: Portal revision is publishing. + #: Portal's revision is being published. PUBLISHING = "publishing" - #: Portal revision publishing completed. + #: Portal's revision publishing completed. COMPLETED = "completed" - #: Portal revision publishing failed. + #: Portal's revision publishing failed. FAILED = "failed" -class ProductState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PreferredIPVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The IP version to be used. Only IPv4 is supported for now. + """ + + I_PV4 = "IPv4" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class ProductState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. @@ -412,12 +521,23 @@ class ProductState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NOT_PUBLISHED = "notPublished" PUBLISHED = "published" -class Protocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Protocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): HTTP = "http" HTTPS = "https" + WS = "ws" + WSS = "wss" + +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether or not public endpoint access is allowed for this API Management service. Value is + optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints + are the exclusive access method. Default value is 'Enabled' + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" -class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuCapacityScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scale type applicable to the sku. """ @@ -428,18 +548,34 @@ class ResourceSkuCapacityScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Scaling not supported. NONE = "none" -class SamplingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SamplingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sampling type. """ #: Fixed-rate sampling. FIXED = "fixed" -class SettingsTypeName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SchemaType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Schema Type. Immutable. + """ + + #: Xml schema type. + XML = "xml" + #: Json schema type. + JSON = "json" + +class SettingsTypeName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PUBLIC = "public" -class SkuType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Severity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The severity of the issue. + """ + + ERROR = "Error" + WARNING = "Warning" + +class SkuType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Name of the Sku. """ @@ -456,20 +592,26 @@ class SkuType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Isolated SKU of Api Management. ISOLATED = "Isolated" -class SoapApiType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Type of Api to create. +class SoapApiType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of API to create. - * ``http`` creates a SOAP to REST API - * ``soap`` creates a SOAP pass-through API . + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. """ #: Imports a SOAP API having a RESTful front end. SOAP_TO_REST = "http" - #: Imports the Soap API having a SOAP front end. + #: Imports the SOAP API having a SOAP front end. SOAP_PASS_THROUGH = "soap" + #: Imports the API having a Websocket front end. + WEB_SOCKET = "websocket" + #: Imports the API having a GraphQL front end. + GRAPH_QL = "graphql" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the issue. """ @@ -484,7 +626,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The issue was closed. CLOSED = "closed" -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SubscriptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been @@ -500,7 +642,7 @@ class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "rejected" CANCELLED = "cancelled" -class TemplateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TemplateName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): APPLICATION_APPROVED_NOTIFICATION_MESSAGE = "applicationApprovedNotificationMessage" ACCOUNT_CLOSED_DEVELOPER = "accountClosedDeveloper" @@ -517,7 +659,7 @@ class TemplateName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECT_DEVELOPER_NOTIFICATION_MESSAGE = "rejectDeveloperNotificationMessage" REQUEST_DEVELOPER_NOTIFICATION_MESSAGE = "requestDeveloperNotificationMessage" -class UserState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. """ @@ -531,7 +673,7 @@ class UserState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: User account is closed. All identities and related entities are removed. DELETED = "deleted" -class Verbosity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Verbosity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The verbosity level applied to traces emitted by trace policies. """ @@ -545,7 +687,7 @@ class Verbosity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: diagnostic instance. ERROR = "error" -class VersioningScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VersioningScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """An value that determines where the API Version identifier will be located in a HTTP request. """ @@ -556,7 +698,7 @@ class VersioningScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The API Version is passed in a HTTP header. HEADER = "Header" -class VirtualNetworkType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VirtualNetworkType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, 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 57cd38822400..daa165d6086d 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 @@ -17,8 +17,8 @@ class AccessInformationCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.AccessInformationContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -38,6 +38,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(AccessInformationCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -45,15 +49,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The Resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -73,6 +79,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -84,18 +92,20 @@ class AccessInformationContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param id_properties_id: Access Information type ('access' or 'gitAccess'). - :type id_properties_id: str - :param principal_id: Principal (User) Identifier. - :type principal_id: str - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :ivar id_properties_id: Access Information type ('access' or 'gitAccess'). + :vartype id_properties_id: str + :ivar principal_id: Principal (User) Identifier. + :vartype principal_id: str + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _validation = { @@ -117,6 +127,14 @@ def __init__( self, **kwargs ): + """ + :keyword id_properties_id: Access Information type ('access' or 'gitAccess'). + :paramtype id_properties_id: str + :keyword principal_id: Principal (User) Identifier. + :paramtype principal_id: str + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationContract, self).__init__(**kwargs) self.id_properties_id = kwargs.get('id_properties_id', None) self.principal_id = kwargs.get('principal_id', None) @@ -126,16 +144,16 @@ def __init__( class AccessInformationCreateParameters(msrest.serialization.Model): """Tenant access information update parameters. - :param principal_id: Principal (User) Identifier. - :type principal_id: str - :param primary_key: Primary access key. This property will not be filled on 'GET' operations! + :ivar principal_id: Principal (User) Identifier. + :vartype principal_id: str + :ivar primary_key: Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type primary_key: str - :param secondary_key: Secondary access key. This property will not be filled on 'GET' + :vartype primary_key: str + :ivar secondary_key: Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type secondary_key: str - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :vartype secondary_key: str + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -149,6 +167,18 @@ def __init__( self, **kwargs ): + """ + :keyword principal_id: Principal (User) Identifier. + :paramtype principal_id: str + :keyword primary_key: Primary access key. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype primary_key: str + :keyword secondary_key: Secondary access key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype secondary_key: str + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationCreateParameters, self).__init__(**kwargs) self.principal_id = kwargs.get('principal_id', None) self.primary_key = kwargs.get('primary_key', None) @@ -159,18 +189,18 @@ def __init__( class AccessInformationSecretsContract(msrest.serialization.Model): """Tenant access information contract of the API Management service. - :param id: Access Information type ('access' or 'gitAccess'). - :type id: str - :param principal_id: Principal (User) Identifier. - :type principal_id: str - :param primary_key: Primary access key. This property will not be filled on 'GET' operations! + :ivar id: Access Information type ('access' or 'gitAccess'). + :vartype id: str + :ivar principal_id: Principal (User) Identifier. + :vartype principal_id: str + :ivar primary_key: Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type primary_key: str - :param secondary_key: Secondary access key. This property will not be filled on 'GET' + :vartype primary_key: str + :ivar secondary_key: Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type secondary_key: str - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :vartype secondary_key: str + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -185,6 +215,20 @@ def __init__( self, **kwargs ): + """ + :keyword id: Access Information type ('access' or 'gitAccess'). + :paramtype id: str + :keyword principal_id: Principal (User) Identifier. + :paramtype principal_id: str + :keyword primary_key: Primary access key. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype primary_key: str + :keyword secondary_key: Secondary access key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype secondary_key: str + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationSecretsContract, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.principal_id = kwargs.get('principal_id', None) @@ -196,8 +240,8 @@ def __init__( class AccessInformationUpdateParameters(msrest.serialization.Model): """Tenant access information update parameters. - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -208,6 +252,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationUpdateParameters, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -219,13 +267,13 @@ class AdditionalLocation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The location name of the additional region among Azure Data center + :ivar location: Required. The location name of the additional region among Azure Data center regions. - :type location: str - :param sku: Required. SKU properties of the API Management service. - :type sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] + :vartype location: str + :ivar sku: Required. SKU properties of the API Management service. + :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard, Premium and Isolated SKU. @@ -234,14 +282,21 @@ class AdditionalLocation(msrest.serialization.Model): service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration for the location. - :type virtual_network_configuration: + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the location. Supported only for Premium SKU being deployed + in Virtual Network. + :vartype public_ip_address_id: str + :ivar virtual_network_configuration: Virtual network configuration for the location. + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration :ivar gateway_regional_url: Gateway URL of the API Management service in the Region. :vartype gateway_regional_url: str - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. - :type disable_gateway: bool + :vartype disable_gateway: bool + :ivar platform_version: Compute Platform Version running the service. Possible values include: + "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion """ _validation = { @@ -250,6 +305,7 @@ class AdditionalLocation(msrest.serialization.Model): 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, 'gateway_regional_url': {'readonly': True}, + 'platform_version': {'readonly': True}, } _attribute_map = { @@ -258,35 +314,58 @@ class AdditionalLocation(msrest.serialization.Model): 'zones': {'key': 'zones', 'type': '[str]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'gateway_regional_url': {'key': 'gatewayRegionalUrl', 'type': 'str'}, 'disable_gateway': {'key': 'disableGateway', 'type': 'bool'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + :keyword location: Required. The location name of the additional region among Azure Data center + regions. + :paramtype location: str + :keyword sku: Required. SKU properties of the API Management service. + :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the location. Supported only for Premium SKU being deployed + in Virtual Network. + :paramtype public_ip_address_id: str + :keyword virtual_network_configuration: Virtual network configuration for the location. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in this additional location. + :paramtype disable_gateway: bool + """ super(AdditionalLocation, self).__init__(**kwargs) self.location = kwargs['location'] self.sku = kwargs['sku'] self.zones = kwargs.get('zones', None) self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = kwargs.get('public_ip_address_id', None) self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) self.gateway_regional_url = None self.disable_gateway = kwargs.get('disable_gateway', False) + self.platform_version = None class ApiCollection(msrest.serialization.Model): - """Paged Api list representation. + """Paged API list representation. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.ApiContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -306,65 +385,116 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(ApiCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) self.next_link = None +class ApiContactInformation(msrest.serialization.Model): + """API contact information. + + :ivar name: The identifying name of the contact person/organization. + :vartype name: str + :ivar url: The URL pointing to the contact information. MUST be in the format of a URL. + :vartype url: str + :ivar email: The email address of the contact person/organization. MUST be in the format of an + email address. + :vartype email: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The identifying name of the contact person/organization. + :paramtype name: str + :keyword url: The URL pointing to the contact information. MUST be in the format of a URL. + :paramtype url: str + :keyword email: The email address of the contact person/organization. MUST be in the format of + an email address. + :paramtype email: str + """ + super(ApiContactInformation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.url = kwargs.get('url', None) + self.email = kwargs.get('email', None) + + class ApiContract(Resource): - """Api details. + """API details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails """ _validation = { @@ -397,6 +527,9 @@ class ApiContract(Resource): 'api_version_description': {'key': 'properties.apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'properties.apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'properties.subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'properties.termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'properties.contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'properties.license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'properties.sourceApiId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, @@ -409,6 +542,57 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + """ super(ApiContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authentication_settings = kwargs.get('authentication_settings', None) @@ -422,6 +606,9 @@ def __init__( self.api_version_description = kwargs.get('api_version_description', None) self.api_version_set_id = kwargs.get('api_version_set_id', None) self.subscription_required = kwargs.get('subscription_required', None) + self.terms_of_service_url = kwargs.get('terms_of_service_url', None) + self.contact = kwargs.get('contact', None) + self.license = kwargs.get('license', None) self.source_api_id = kwargs.get('source_api_id', None) self.display_name = kwargs.get('display_name', None) self.service_url = kwargs.get('service_url', None) @@ -435,33 +622,41 @@ class ApiEntityBaseContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation """ _validation = { @@ -485,12 +680,51 @@ class ApiEntityBaseContract(msrest.serialization.Model): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + """ super(ApiEntityBaseContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authentication_settings = kwargs.get('authentication_settings', None) @@ -504,57 +738,68 @@ def __init__( self.api_version_description = kwargs.get('api_version_description', None) self.api_version_set_id = kwargs.get('api_version_set_id', None) self.subscription_required = kwargs.get('subscription_required', None) + self.terms_of_service_url = kwargs.get('terms_of_service_url', None) + self.contact = kwargs.get('contact', None) + self.license = kwargs.get('license', None) class ApiContractProperties(ApiEntityBaseContract): - """Api Entity Properties. + """API Entity Properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Required. Relative URL uniquely identifying this API and all of its resource paths + :vartype service_url: str + :ivar path: Required. Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails """ _validation = { @@ -581,6 +826,9 @@ class ApiContractProperties(ApiEntityBaseContract): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'sourceApiId', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, @@ -593,6 +841,57 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Required. Relative URL uniquely identifying this API and all of its resource + paths within the API Management service instance. It is appended to the API endpoint base URL + specified during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + """ super(ApiContractProperties, self).__init__(**kwargs) self.source_api_id = kwargs.get('source_api_id', None) self.display_name = kwargs.get('display_name', None) @@ -607,43 +906,51 @@ class ApiContractUpdateProperties(ApiEntityBaseContract): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param display_name: API name. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar display_name: API name. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] """ _validation = { @@ -670,6 +977,9 @@ class ApiContractUpdateProperties(ApiEntityBaseContract): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, 'path': {'key': 'path', 'type': 'str'}, @@ -680,6 +990,52 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword display_name: API name. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + """ super(ApiContractUpdateProperties, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.service_url = kwargs.get('service_url', None) @@ -692,62 +1048,74 @@ class ApiCreateOrUpdateParameter(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails - :param value: Content value when Importing an API. - :type value: str - :param format: Format of the Content in which the API is getting imported. Possible values + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :ivar value: Content value when Importing an API. + :vartype value: str + :ivar format: Format of the Content in which the API is getting imported. Possible values include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", - "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link". - :type format: str or ~azure.mgmt.apimanagement.models.ContentFormat - :param wsdl_selector: Criteria to limit import of WSDL to a subset of the document. - :type wsdl_selector: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector - :param soap_api_type: Type of Api to create. + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :vartype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :ivar wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :vartype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :ivar soap_api_type: Type of API to create. - * ``http`` creates a SOAP to REST API - * ``soap`` creates a SOAP pass-through API . Possible values include: "http", "soap". - :type soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType """ _validation = { @@ -774,6 +1142,9 @@ class ApiCreateOrUpdateParameter(msrest.serialization.Model): 'api_version_description': {'key': 'properties.apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'properties.apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'properties.subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'properties.termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'properties.contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'properties.license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'properties.sourceApiId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, @@ -790,6 +1161,75 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :keyword value: Content value when Importing an API. + :paramtype value: str + :keyword format: Format of the Content in which the API is getting imported. Possible values + include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :paramtype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :keyword wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :paramtype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :keyword soap_api_type: Type of API to create. + + + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + """ super(ApiCreateOrUpdateParameter, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authentication_settings = kwargs.get('authentication_settings', None) @@ -803,6 +1243,9 @@ def __init__( self.api_version_description = kwargs.get('api_version_description', None) self.api_version_set_id = kwargs.get('api_version_set_id', None) self.subscription_required = kwargs.get('subscription_required', None) + self.terms_of_service_url = kwargs.get('terms_of_service_url', None) + self.contact = kwargs.get('contact', None) + self.license = kwargs.get('license', None) self.source_api_id = kwargs.get('source_api_id', None) self.display_name = kwargs.get('display_name', None) self.service_url = kwargs.get('service_url', None) @@ -816,68 +1259,80 @@ def __init__( class ApiCreateOrUpdateProperties(ApiContractProperties): - """Api Create or Update Properties. + """API Create or Update Properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Required. Relative URL uniquely identifying this API and all of its resource paths + :vartype service_url: str + :ivar path: Required. Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails - :param value: Content value when Importing an API. - :type value: str - :param format: Format of the Content in which the API is getting imported. Possible values + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :ivar value: Content value when Importing an API. + :vartype value: str + :ivar format: Format of the Content in which the API is getting imported. Possible values include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", - "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link". - :type format: str or ~azure.mgmt.apimanagement.models.ContentFormat - :param wsdl_selector: Criteria to limit import of WSDL to a subset of the document. - :type wsdl_selector: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector - :param soap_api_type: Type of Api to create. + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :vartype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :ivar wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :vartype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :ivar soap_api_type: Type of API to create. - * ``http`` creates a SOAP to REST API - * ``soap`` creates a SOAP pass-through API . Possible values include: "http", "soap". - :type soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType """ _validation = { @@ -904,6 +1359,9 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'sourceApiId', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, @@ -920,6 +1378,75 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Required. Relative URL uniquely identifying this API and all of its resource + paths within the API Management service instance. It is appended to the API endpoint base URL + specified during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :keyword value: Content value when Importing an API. + :paramtype value: str + :keyword format: Format of the Content in which the API is getting imported. Possible values + include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :paramtype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :keyword wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :paramtype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :keyword soap_api_type: Type of API to create. + + + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + """ super(ApiCreateOrUpdateProperties, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.format = kwargs.get('format', None) @@ -930,10 +1457,10 @@ def __init__( class ApiCreateOrUpdatePropertiesWsdlSelector(msrest.serialization.Model): """Criteria to limit import of WSDL to a subset of the document. - :param wsdl_service_name: Name of service to import from WSDL. - :type wsdl_service_name: str - :param wsdl_endpoint_name: Name of endpoint(port) to import from WSDL. - :type wsdl_endpoint_name: str + :ivar wsdl_service_name: Name of service to import from WSDL. + :vartype wsdl_service_name: str + :ivar wsdl_endpoint_name: Name of endpoint(port) to import from WSDL. + :vartype wsdl_endpoint_name: str """ _attribute_map = { @@ -945,6 +1472,12 @@ def __init__( self, **kwargs ): + """ + :keyword wsdl_service_name: Name of service to import from WSDL. + :paramtype wsdl_service_name: str + :keyword wsdl_endpoint_name: Name of endpoint(port) to import from WSDL. + :paramtype wsdl_endpoint_name: str + """ super(ApiCreateOrUpdatePropertiesWsdlSelector, self).__init__(**kwargs) self.wsdl_service_name = kwargs.get('wsdl_service_name', None) self.wsdl_endpoint_name = kwargs.get('wsdl_endpoint_name', None) @@ -953,14 +1486,14 @@ def __init__( class ApiExportResult(msrest.serialization.Model): """API Export result. - :param id: ResourceId of the API which was exported. - :type id: str - :param export_result_format: Format in which the Api Details are exported to the Storage Blob + :ivar id: ResourceId of the API which was exported. + :vartype id: str + :ivar export_result_format: Format in which the API Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: "swagger-link-json", "wsdl-link+xml", "wadl-link-json", "openapi-link". - :type export_result_format: str or ~azure.mgmt.apimanagement.models.ExportResultFormat - :param value: The object defining the schema of the exported Api Detail. - :type value: ~azure.mgmt.apimanagement.models.ApiExportResultValue + :vartype export_result_format: str or ~azure.mgmt.apimanagement.models.ExportResultFormat + :ivar value: The object defining the schema of the exported API Detail. + :vartype value: ~azure.mgmt.apimanagement.models.ApiExportResultValue """ _attribute_map = { @@ -973,6 +1506,16 @@ def __init__( self, **kwargs ): + """ + :keyword id: ResourceId of the API which was exported. + :paramtype id: str + :keyword export_result_format: Format in which the API Details are exported to the Storage Blob + with Sas Key valid for 5 minutes. Possible values include: "swagger-link-json", + "wsdl-link+xml", "wadl-link-json", "openapi-link". + :paramtype export_result_format: str or ~azure.mgmt.apimanagement.models.ExportResultFormat + :keyword value: The object defining the schema of the exported API Detail. + :paramtype value: ~azure.mgmt.apimanagement.models.ApiExportResultValue + """ super(ApiExportResult, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.export_result_format = kwargs.get('export_result_format', None) @@ -980,11 +1523,11 @@ def __init__( class ApiExportResultValue(msrest.serialization.Model): - """The object defining the schema of the exported Api Detail. + """The object defining the schema of the exported API Detail. - :param link: Link to the Storage Blob containing the result of the export operation. The Blob + :ivar link: Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. - :type link: str + :vartype link: str """ _attribute_map = { @@ -995,16 +1538,50 @@ def __init__( self, **kwargs ): + """ + :keyword link: Link to the Storage Blob containing the result of the export operation. The Blob + Uri is only valid for 5 minutes. + :paramtype link: str + """ super(ApiExportResultValue, self).__init__(**kwargs) self.link = kwargs.get('link', None) +class ApiLicenseInformation(msrest.serialization.Model): + """API license information. + + :ivar name: The license name used for the API. + :vartype name: str + :ivar url: A URL to the license used for the API. MUST be in the format of a URL. + :vartype url: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The license name used for the API. + :paramtype name: str + :keyword url: A URL to the license used for the API. MUST be in the format of a URL. + :paramtype url: str + """ + super(ApiLicenseInformation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.url = kwargs.get('url', None) + + class ApiManagementServiceApplyNetworkConfigurationParameters(msrest.serialization.Model): """Parameter supplied to the Apply Network configuration operation. - :param location: Location of the Api Management service to update for a multi-region service. + :ivar location: Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. - :type location: str + :vartype location: str """ _attribute_map = { @@ -1015,6 +1592,11 @@ def __init__( self, **kwargs ): + """ + :keyword location: Location of the Api Management service to update for a multi-region service. + For a service deployed in a single region, this parameter is not required. + :paramtype location: str + """ super(ApiManagementServiceApplyNetworkConfigurationParameters, self).__init__(**kwargs) self.location = kwargs.get('location', None) @@ -1024,42 +1606,72 @@ class ApiManagementServiceBackupRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account: Required. Azure Cloud Storage account (used to place/retrieve the - backup) name. - :type storage_account: str - :param access_key: Required. Azure Cloud Storage account (used to place/retrieve the backup) - access key. - :type access_key: str - :param container_name: Required. Azure Cloud Storage blob container name used to place/retrieve - the backup. - :type container_name: str - :param backup_name: Required. The name of the backup file to create. - :type backup_name: str + :ivar storage_account: Required. The name of the Azure storage account (used to place/retrieve + the backup). + :vartype storage_account: str + :ivar container_name: Required. The name of the blob container (used to place/retrieve the + backup). + :vartype container_name: str + :ivar backup_name: Required. The name of the backup file to create/retrieve. + :vartype backup_name: str + :ivar access_type: The type of access to be used for the storage account. Possible values + include: "AccessKey", "SystemAssignedManagedIdentity", "UserAssignedManagedIdentity". Default + value: "AccessKey". + :vartype access_type: str or ~azure.mgmt.apimanagement.models.AccessType + :ivar access_key: Storage account access key. Required only if ``accessType`` is set to + ``AccessKey``. + :vartype access_key: str + :ivar client_id: The Client ID of user assigned managed identity. Required only if + ``accessType`` is set to ``UserAssignedManagedIdentity``. + :vartype client_id: str """ _validation = { 'storage_account': {'required': True}, - 'access_key': {'required': True}, 'container_name': {'required': True}, 'backup_name': {'required': True}, } _attribute_map = { 'storage_account': {'key': 'storageAccount', 'type': 'str'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, 'container_name': {'key': 'containerName', 'type': 'str'}, 'backup_name': {'key': 'backupName', 'type': 'str'}, + 'access_type': {'key': 'accessType', 'type': 'str'}, + 'access_key': {'key': 'accessKey', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + :keyword storage_account: Required. The name of the Azure storage account (used to + place/retrieve the backup). + :paramtype storage_account: str + :keyword container_name: Required. The name of the blob container (used to place/retrieve the + backup). + :paramtype container_name: str + :keyword backup_name: Required. The name of the backup file to create/retrieve. + :paramtype backup_name: str + :keyword access_type: The type of access to be used for the storage account. Possible values + include: "AccessKey", "SystemAssignedManagedIdentity", "UserAssignedManagedIdentity". Default + value: "AccessKey". + :paramtype access_type: str or ~azure.mgmt.apimanagement.models.AccessType + :keyword access_key: Storage account access key. Required only if ``accessType`` is set to + ``AccessKey``. + :paramtype access_key: str + :keyword client_id: The Client ID of user assigned managed identity. Required only if + ``accessType`` is set to ``UserAssignedManagedIdentity``. + :paramtype client_id: str + """ super(ApiManagementServiceBackupRestoreParameters, self).__init__(**kwargs) self.storage_account = kwargs['storage_account'] - self.access_key = kwargs['access_key'] self.container_name = kwargs['container_name'] self.backup_name = kwargs['backup_name'] + self.access_type = kwargs.get('access_type', "AccessKey") + self.access_key = kwargs.get('access_key', None) + self.client_id = kwargs.get('client_id', None) class ApiManagementServiceBaseProperties(msrest.serialization.Model): @@ -1067,8 +1679,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1091,8 +1703,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1100,13 +1712,22 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1133,30 +1754,36 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion """ _validation = { @@ -1172,6 +1799,7 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, } _attribute_map = { @@ -1188,6 +1816,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): 'hostname_configurations': {'key': 'hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, @@ -1197,12 +1827,90 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): 'virtual_network_type': {'key': 'virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'restore', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + """ super(ApiManagementServiceBaseProperties, self).__init__(**kwargs) self.notification_sender_email = kwargs.get('notification_sender_email', None) self.provisioning_state = None @@ -1217,6 +1925,8 @@ def __init__( self.hostname_configurations = kwargs.get('hostname_configurations', None) self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = kwargs.get('public_ip_address_id', None) + self.public_network_access = kwargs.get('public_network_access', None) self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) self.additional_locations = kwargs.get('additional_locations', None) self.custom_properties = kwargs.get('custom_properties', None) @@ -1226,6 +1936,8 @@ def __init__( self.virtual_network_type = kwargs.get('virtual_network_type', "None") self.api_version_constraint = kwargs.get('api_version_constraint', None) self.restore = kwargs.get('restore', False) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.platform_version = None class ApiManagementServiceCheckNameAvailabilityParameters(msrest.serialization.Model): @@ -1233,8 +1945,8 @@ class ApiManagementServiceCheckNameAvailabilityParameters(msrest.serialization.M All required parameters must be populated in order to send to Azure. - :param name: Required. The name to check for availability. - :type name: str + :ivar name: Required. The name to check for availability. + :vartype name: str """ _validation = { @@ -1249,6 +1961,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The name to check for availability. + :paramtype name: str + """ super(ApiManagementServiceCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1274,6 +1990,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementServiceGetDomainOwnershipIdentifierResult, self).__init__(**kwargs) self.domain_ownership_identifier = None @@ -1281,8 +1999,8 @@ def __init__( class ApiManagementServiceGetSsoTokenResult(msrest.serialization.Model): """The response of the GetSsoToken operation. - :param redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. - :type redirect_uri: str + :ivar redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. + :vartype redirect_uri: str """ _attribute_map = { @@ -1293,6 +2011,10 @@ def __init__( self, **kwargs ): + """ + :keyword redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. + :paramtype redirect_uri: str + """ super(ApiManagementServiceGetSsoTokenResult, self).__init__(**kwargs) self.redirect_uri = kwargs.get('redirect_uri', None) @@ -1304,21 +2026,21 @@ class ApiManagementServiceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of identity used for the resource. The type 'SystemAssigned, + :ivar type: Required. The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.apimanagement.models.ApimIdentityType + :vartype type: str or ~azure.mgmt.apimanagement.models.ApimIdentityType :ivar principal_id: The principal id of the identity. :vartype principal_id: str :ivar tenant_id: The client tenant id of the identity. :vartype tenant_id: str - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.apimanagement.models.UserIdentityProperties] """ @@ -1339,6 +2061,20 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the service. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.apimanagement.models.ApimIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.apimanagement.models.UserIdentityProperties] + """ super(ApiManagementServiceIdentity, self).__init__(**kwargs) self.type = kwargs['type'] self.principal_id = None @@ -1351,11 +2087,11 @@ class ApiManagementServiceListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. Result of the List API Management services operation. - :type value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Required. Result of the List API Management services operation. + :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of API Management services. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1371,6 +2107,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Required. Result of the List API Management services operation. + :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of API Management services. + :paramtype next_link: str + """ super(ApiManagementServiceListResult, self).__init__(**kwargs) self.value = kwargs['value'] self.next_link = kwargs.get('next_link', None) @@ -1389,11 +2132,11 @@ class ApiManagementServiceNameAvailabilityResult(msrest.serialization.Model): If reason == AlreadyExists, explain that :code:`` is already in use, and direct them to select a different name. :vartype message: str - :param reason: Invalid indicates the name provided does not match the resource provider’s - naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates - that the name is already in use and is therefore unavailable. Possible values include: "Valid", + :ivar reason: Invalid indicates the name provided does not match the resource provider’s naming + requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the + name is already in use and is therefore unavailable. Possible values include: "Valid", "Invalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.apimanagement.models.NameAvailabilityReason + :vartype reason: str or ~azure.mgmt.apimanagement.models.NameAvailabilityReason """ _validation = { @@ -1411,6 +2154,13 @@ def __init__( self, **kwargs ): + """ + :keyword reason: Invalid indicates the name provided does not match the resource provider’s + naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates + that the name is already in use and is therefore unavailable. Possible values include: "Valid", + "Invalid", "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.apimanagement.models.NameAvailabilityReason + """ super(ApiManagementServiceNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.message = None @@ -1424,8 +2174,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): All required parameters must be populated in order to send to Azure. - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1448,8 +2198,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1457,13 +2207,22 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1490,34 +2249,40 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Required. Publisher email. - :type publisher_email: str - :param publisher_name: Required. Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Required. Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Required. Publisher name. + :vartype publisher_name: str """ _validation = { @@ -1533,6 +2298,7 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'required': True, 'max_length': 100, 'min_length': 0}, 'publisher_name': {'required': True, 'max_length': 100, 'min_length': 0}, } @@ -1551,6 +2317,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): 'hostname_configurations': {'key': 'hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, @@ -1560,6 +2328,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): 'virtual_network_type': {'key': 'virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'publisherName', 'type': 'str'}, } @@ -1568,6 +2338,86 @@ def __init__( self, **kwargs ): + """ + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Required. Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Required. Publisher name. + :paramtype publisher_name: str + """ super(ApiManagementServiceProperties, self).__init__(**kwargs) self.publisher_email = kwargs['publisher_email'] self.publisher_name = kwargs['publisher_name'] @@ -1584,8 +2434,8 @@ class ApimResource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -1605,6 +2455,10 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ApimResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1625,20 +2479,22 @@ class ApiManagementServiceResource(ApimResource): :vartype name: str :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Required. SKU properties of the API Management service. - :type sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties - :param identity: Managed service identity of the Api Management service. - :type identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity - :param location: Required. Resource location. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Required. SKU properties of the API Management service. + :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :ivar identity: Managed service identity of the Api Management service. + :vartype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.apimanagement.models.SystemData + :ivar location: Required. Resource location. + :vartype location: str :ivar etag: ETag of the resource. :vartype etag: str - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1661,8 +2517,8 @@ class ApiManagementServiceResource(ApimResource): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1670,13 +2526,22 @@ class ApiManagementServiceResource(ApimResource): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1703,34 +2568,40 @@ class ApiManagementServiceResource(ApimResource): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Required. Publisher email. - :type publisher_email: str - :param publisher_name: Required. Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Required. Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Required. Publisher name. + :vartype publisher_name: str """ _validation = { @@ -1738,6 +2609,7 @@ class ApiManagementServiceResource(ApimResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'sku': {'required': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, 'etag': {'readonly': True}, 'notification_sender_email': {'max_length': 100, 'min_length': 0}, @@ -1752,6 +2624,7 @@ class ApiManagementServiceResource(ApimResource): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'required': True, 'max_length': 100, 'min_length': 0}, 'publisher_name': {'required': True, 'max_length': 100, 'min_length': 0}, } @@ -1763,6 +2636,7 @@ class ApiManagementServiceResource(ApimResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'ApiManagementServiceSkuProperties'}, 'identity': {'key': 'identity', 'type': 'ApiManagementServiceIdentity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, @@ -1779,6 +2653,8 @@ class ApiManagementServiceResource(ApimResource): 'hostname_configurations': {'key': 'properties.hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'properties.publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'properties.privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'properties.publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'properties.additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'properties.customProperties', 'type': '{str}'}, @@ -1788,6 +2664,8 @@ class ApiManagementServiceResource(ApimResource): 'virtual_network_type': {'key': 'properties.virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'properties.apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'properties.restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'properties.platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'properties.publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, } @@ -1796,9 +2674,100 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Required. SKU properties of the API Management service. + :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :keyword identity: Managed service identity of the Api Management service. + :paramtype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :keyword location: Required. Resource location. + :paramtype location: str + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Required. Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Required. Publisher name. + :paramtype publisher_name: str + """ super(ApiManagementServiceResource, self).__init__(**kwargs) self.sku = kwargs['sku'] self.identity = kwargs.get('identity', None) + self.system_data = None self.location = kwargs['location'] self.etag = None self.zones = kwargs.get('zones', None) @@ -1815,6 +2784,8 @@ def __init__( self.hostname_configurations = kwargs.get('hostname_configurations', None) self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = kwargs.get('public_ip_address_id', None) + self.public_network_access = kwargs.get('public_network_access', None) self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) self.additional_locations = kwargs.get('additional_locations', None) self.custom_properties = kwargs.get('custom_properties', None) @@ -1824,6 +2795,8 @@ def __init__( self.virtual_network_type = kwargs.get('virtual_network_type', "None") self.api_version_constraint = kwargs.get('api_version_constraint', None) self.restore = kwargs.get('restore', False) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.platform_version = None self.publisher_email = kwargs['publisher_email'] self.publisher_name = kwargs['publisher_name'] @@ -1833,12 +2806,12 @@ class ApiManagementServiceSkuProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the Sku. Possible values include: "Developer", "Standard", + :ivar name: Required. Name of the Sku. Possible values include: "Developer", "Standard", "Premium", "Basic", "Consumption", "Isolated". - :type name: str or ~azure.mgmt.apimanagement.models.SkuType - :param capacity: Required. Capacity of the SKU (number of deployed units of the SKU). For + :vartype name: str or ~azure.mgmt.apimanagement.models.SkuType + :ivar capacity: Required. Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. - :type capacity: int + :vartype capacity: int """ _validation = { @@ -1855,6 +2828,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the Sku. Possible values include: "Developer", "Standard", + "Premium", "Basic", "Consumption", "Isolated". + :paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType + :keyword capacity: Required. Capacity of the SKU (number of deployed units of the SKU). For + Consumption SKU capacity must be specified as 0. + :paramtype capacity: int + """ super(ApiManagementServiceSkuProperties, self).__init__(**kwargs) self.name = kwargs['name'] self.capacity = kwargs['capacity'] @@ -1871,16 +2852,18 @@ class ApiManagementServiceUpdateParameters(ApimResource): :vartype name: str :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: SKU properties of the API Management service. - :type sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties - :param identity: Managed service identity of the Api Management service. - :type identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: SKU properties of the API Management service. + :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :ivar identity: Managed service identity of the Api Management service. + :vartype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity :ivar etag: ETag of the resource. :vartype etag: str - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1903,8 +2886,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1912,13 +2895,22 @@ class ApiManagementServiceUpdateParameters(ApimResource): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1945,34 +2937,40 @@ class ApiManagementServiceUpdateParameters(ApimResource): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Publisher email. - :type publisher_email: str - :param publisher_name: Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Publisher name. + :vartype publisher_name: str """ _validation = { @@ -1992,6 +2990,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'max_length': 100, 'min_length': 0}, 'publisher_name': {'max_length': 100, 'min_length': 0}, } @@ -2004,6 +3003,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'sku': {'key': 'sku', 'type': 'ApiManagementServiceSkuProperties'}, 'identity': {'key': 'identity', 'type': 'ApiManagementServiceIdentity'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, 'notification_sender_email': {'key': 'properties.notificationSenderEmail', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'target_provisioning_state': {'key': 'properties.targetProvisioningState', 'type': 'str'}, @@ -2017,6 +3017,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'hostname_configurations': {'key': 'properties.hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'properties.publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'properties.privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'properties.publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'properties.additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'properties.customProperties', 'type': '{str}'}, @@ -2026,6 +3028,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'virtual_network_type': {'key': 'properties.virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'properties.apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'properties.restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'properties.platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'properties.publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, } @@ -2034,10 +3038,99 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: SKU properties of the API Management service. + :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :keyword identity: Managed service identity of the Api Management service. + :paramtype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Publisher name. + :paramtype publisher_name: str + """ super(ApiManagementServiceUpdateParameters, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) self.identity = kwargs.get('identity', None) self.etag = None + self.zones = kwargs.get('zones', None) self.notification_sender_email = kwargs.get('notification_sender_email', None) self.provisioning_state = None self.target_provisioning_state = None @@ -2051,6 +3144,8 @@ def __init__( self.hostname_configurations = kwargs.get('hostname_configurations', None) self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = kwargs.get('public_ip_address_id', None) + self.public_network_access = kwargs.get('public_network_access', None) self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) self.additional_locations = kwargs.get('additional_locations', None) self.custom_properties = kwargs.get('custom_properties', None) @@ -2060,6 +3155,8 @@ def __init__( self.virtual_network_type = kwargs.get('virtual_network_type', "None") self.api_version_constraint = kwargs.get('api_version_constraint', None) self.restore = kwargs.get('restore', False) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.platform_version = None self.publisher_email = kwargs.get('publisher_email', None) self.publisher_name = kwargs.get('publisher_name', None) @@ -2069,8 +3166,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -2093,8 +3190,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -2102,13 +3199,22 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -2135,34 +3241,40 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Publisher email. - :type publisher_email: str - :param publisher_name: Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Publisher name. + :vartype publisher_name: str """ _validation = { @@ -2178,6 +3290,7 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'max_length': 100, 'min_length': 0}, 'publisher_name': {'max_length': 100, 'min_length': 0}, } @@ -2196,6 +3309,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): 'hostname_configurations': {'key': 'hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, @@ -2205,6 +3320,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): 'virtual_network_type': {'key': 'virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'publisherName', 'type': 'str'}, } @@ -2213,6 +3330,86 @@ def __init__( self, **kwargs ): + """ + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Publisher name. + :paramtype publisher_name: str + """ super(ApiManagementServiceUpdateProperties, self).__init__(**kwargs) self.publisher_email = kwargs.get('publisher_email', None) self.publisher_name = kwargs.get('publisher_name', None) @@ -2291,6 +3488,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -2332,6 +3531,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -2371,6 +3572,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -2407,6 +3610,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -2442,6 +3647,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -2473,6 +3680,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -2514,6 +3723,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -2528,8 +3739,8 @@ class ApiManagementSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] + :ivar value: Required. The list of skus available for the subscription. + :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] :ivar next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus. :vartype next_link: str @@ -2549,6 +3760,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Required. The list of skus available for the subscription. + :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] + """ super(ApiManagementSkusResult, self).__init__(**kwargs) self.value = kwargs['value'] self.next_link = None @@ -2580,6 +3795,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuZoneDetails, self).__init__(**kwargs) self.name = None self.capabilities = None @@ -2592,8 +3809,8 @@ class ApiReleaseCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.ApiReleaseContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -2613,6 +3830,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(ApiReleaseCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -2624,21 +3845,23 @@ class ApiReleaseContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param api_id: Identifier of the API the release belongs to. - :type api_id: str + :ivar api_id: Identifier of the API the release belongs to. + :vartype api_id: str :ivar created_date_time: The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. :vartype created_date_time: ~datetime.datetime :ivar updated_date_time: The time the API release was updated. :vartype updated_date_time: ~datetime.datetime - :param notes: Release Notes. - :type notes: str + :ivar notes: Release Notes. + :vartype notes: str """ _validation = { @@ -2663,6 +3886,12 @@ def __init__( self, **kwargs ): + """ + :keyword api_id: Identifier of the API the release belongs to. + :paramtype api_id: str + :keyword notes: Release Notes. + :paramtype notes: str + """ super(ApiReleaseContract, self).__init__(**kwargs) self.api_id = kwargs.get('api_id', None) self.created_date_time = None @@ -2671,14 +3900,14 @@ def __init__( class ApiRevisionCollection(msrest.serialization.Model): - """Paged Api Revision list representation. + """Paged API Revision list representation. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.ApiRevisionContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -2698,6 +3927,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(ApiRevisionCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -2755,6 +3988,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiRevisionContract, self).__init__(**kwargs) self.api_id = None self.api_revision = None @@ -2769,14 +4004,14 @@ def __init__( class ApiRevisionInfoContract(msrest.serialization.Model): """Object used to create an API Revision or Version based on an existing API Revision. - :param source_api_id: Resource identifier of API to be used to create the revision from. - :type source_api_id: str - :param api_version_name: Version identifier for the new API Version. - :type api_version_name: str - :param api_revision_description: Description of new API Revision. - :type api_revision_description: str - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :ivar source_api_id: Resource identifier of API to be used to create the revision from. + :vartype source_api_id: str + :ivar api_version_name: Version identifier for the new API Version. + :vartype api_version_name: str + :ivar api_revision_description: Description of new API Revision. + :vartype api_revision_description: str + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails """ _validation = { @@ -2795,6 +4030,16 @@ def __init__( self, **kwargs ): + """ + :keyword source_api_id: Resource identifier of API to be used to create the revision from. + :paramtype source_api_id: str + :keyword api_version_name: Version identifier for the new API Version. + :paramtype api_version_name: str + :keyword api_revision_description: Description of new API Revision. + :paramtype api_revision_description: str + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + """ super(ApiRevisionInfoContract, self).__init__(**kwargs) self.source_api_id = kwargs.get('source_api_id', None) self.api_version_name = kwargs.get('api_version_name', None) @@ -2807,45 +4052,53 @@ class ApiTagResourceContractProperties(ApiEntityBaseContract): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param id: API identifier in the form /apis/{apiId}. - :type id: str - :param name: API name. - :type name: str - :param service_url: Absolute URL of the backend service implementing this API. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar id: API identifier in the form /apis/{apiId}. + :vartype id: str + :ivar name: API name. + :vartype name: str + :ivar service_url: Absolute URL of the backend service implementing this API. + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] """ _validation = { @@ -2872,6 +4125,9 @@ class ApiTagResourceContractProperties(ApiEntityBaseContract): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, @@ -2883,6 +4139,54 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword id: API identifier in the form /apis/{apiId}. + :paramtype id: str + :keyword name: API name. + :paramtype name: str + :keyword service_url: Absolute URL of the backend service implementing this API. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + """ super(ApiTagResourceContractProperties, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -2896,43 +4200,51 @@ class ApiUpdateContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param display_name: API name. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar display_name: API name. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] """ _validation = { @@ -2959,6 +4271,9 @@ class ApiUpdateContract(msrest.serialization.Model): 'api_version_description': {'key': 'properties.apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'properties.apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'properties.subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'properties.termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'properties.contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'properties.license', 'type': 'ApiLicenseInformation'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, 'path': {'key': 'properties.path', 'type': 'str'}, @@ -2969,6 +4284,52 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword display_name: API name. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + """ super(ApiUpdateContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authentication_settings = kwargs.get('authentication_settings', None) @@ -2982,6 +4343,9 @@ def __init__( self.api_version_description = kwargs.get('api_version_description', None) self.api_version_set_id = kwargs.get('api_version_set_id', None) self.subscription_required = kwargs.get('subscription_required', None) + self.terms_of_service_url = kwargs.get('terms_of_service_url', None) + self.contact = kwargs.get('contact', None) + self.license = kwargs.get('license', None) self.display_name = kwargs.get('display_name', None) self.service_url = kwargs.get('service_url', None) self.path = kwargs.get('path', None) @@ -2991,9 +4355,9 @@ def __init__( class ApiVersionConstraint(msrest.serialization.Model): """Control Plane Apis version constraint for the API Management service. - :param min_api_version: Limit control plane API calls to API Management service with version + :ivar min_api_version: Limit control plane API calls to API Management service with version equal to or newer than this value. - :type min_api_version: str + :vartype min_api_version: str """ _attribute_map = { @@ -3004,19 +4368,24 @@ def __init__( self, **kwargs ): + """ + :keyword min_api_version: Limit control plane API calls to API Management service with version + equal to or newer than this value. + :paramtype min_api_version: str + """ super(ApiVersionConstraint, self).__init__(**kwargs) self.min_api_version = kwargs.get('min_api_version', None) class ApiVersionSetCollection(msrest.serialization.Model): - """Paged Api Version Set list representation. + """Paged API Version Set list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -3029,6 +4398,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(ApiVersionSetCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -3036,29 +4413,31 @@ def __init__( class ApiVersionSetContract(Resource): - """Api Version Set Contract details. + """API Version Set Contract details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Name of API Version Set. - :type display_name: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :vartype version_header_name: str + :ivar display_name: Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3085,6 +4464,21 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.version_query_name = kwargs.get('version_query_name', None) @@ -3096,23 +4490,22 @@ def __init__( class ApiVersionSetContractDetails(msrest.serialization.Model): """An API Version Set contains the common configuration for a set of API Versions relating. - :param id: Identifier for existing API Version Set. Omit this value to create a new Version - Set. - :type id: str - :param name: The display Name of the API Version Set. - :type name: str - :param description: Description of API Version Set. - :type description: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :ivar id: Identifier for existing API Version Set. Omit this value to create a new Version Set. + :vartype id: str + :ivar name: The display Name of the API Version Set. + :vartype name: str + :ivar description: Description of API Version Set. + :vartype description: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetailsVersioningScheme - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str + :vartype version_header_name: str """ _attribute_map = { @@ -3128,6 +4521,25 @@ def __init__( self, **kwargs ): + """ + :keyword id: Identifier for existing API Version Set. Omit this value to create a new Version + Set. + :paramtype id: str + :keyword name: The display Name of the API Version Set. + :paramtype name: str + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or + ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetailsVersioningScheme + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + """ super(ApiVersionSetContractDetails, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -3138,16 +4550,16 @@ def __init__( class ApiVersionSetEntityBase(msrest.serialization.Model): - """Api Version set base parameters. + """API Version set base parameters. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str + :vartype version_header_name: str """ _validation = { @@ -3165,6 +4577,16 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + """ super(ApiVersionSetEntityBase, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.version_query_name = kwargs.get('version_query_name', None) @@ -3176,19 +4598,19 @@ class ApiVersionSetContractProperties(ApiVersionSetEntityBase): All required parameters must be populated in order to send to Azure. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Required. Name of API Version Set. - :type display_name: str - :param versioning_scheme: Required. An value that determines where the API Version identifier + :vartype version_header_name: str + :ivar display_name: Required. Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: Required. An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3210,27 +4632,42 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Required. Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: Required. An value that determines where the API Version identifier + will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] self.versioning_scheme = kwargs['versioning_scheme'] class ApiVersionSetUpdateParameters(msrest.serialization.Model): - """Parameters to update or create an Api Version Set Contract. + """Parameters to update or create an API Version Set Contract. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Name of API Version Set. - :type display_name: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :vartype version_header_name: str + :ivar display_name: Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3251,6 +4688,21 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetUpdateParameters, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.version_query_name = kwargs.get('version_query_name', None) @@ -3262,19 +4714,19 @@ def __init__( class ApiVersionSetUpdateParametersProperties(ApiVersionSetEntityBase): """Properties used to create or update an API Version Set. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Name of API Version Set. - :type display_name: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :vartype version_header_name: str + :ivar display_name: Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3295,25 +4747,69 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetUpdateParametersProperties, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.versioning_scheme = kwargs.get('versioning_scheme', None) +class ArmIdWrapper(msrest.serialization.Model): + """A wrapper for an ARM resource id. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArmIdWrapper, self).__init__(**kwargs) + self.id = None + + class AssociationContract(Resource): """Association entity details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param provisioning_state: Provisioning state. The only acceptable values to pass in are None + :ivar provisioning_state: Provisioning state. The only acceptable values to pass in are None and "created". The default value is None. - :type provisioning_state: str + :vartype provisioning_state: str """ _validation = { @@ -3333,6 +4829,11 @@ def __init__( self, **kwargs ): + """ + :keyword provisioning_state: Provisioning state. The only acceptable values to pass in are None + and "created". The default value is None. + :paramtype provisioning_state: str + """ super(AssociationContract, self).__init__(**kwargs) self.provisioning_state = kwargs.get('provisioning_state', None) @@ -3340,10 +4841,10 @@ def __init__( class AuthenticationSettingsContract(msrest.serialization.Model): """API Authentication Settings. - :param o_auth2: OAuth2 Authentication settings. - :type o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract - :param openid: OpenID Connect Authentication Settings. - :type openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + :ivar o_auth2: OAuth2 Authentication settings. + :vartype o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract + :ivar openid: OpenID Connect Authentication Settings. + :vartype openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract """ _attribute_map = { @@ -3355,6 +4856,12 @@ def __init__( self, **kwargs ): + """ + :keyword o_auth2: OAuth2 Authentication settings. + :paramtype o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract + :keyword openid: OpenID Connect Authentication Settings. + :paramtype openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + """ super(AuthenticationSettingsContract, self).__init__(**kwargs) self.o_auth2 = kwargs.get('o_auth2', None) self.openid = kwargs.get('openid', None) @@ -3363,12 +4870,12 @@ def __init__( class AuthorizationServerCollection(msrest.serialization.Model): """Paged OAuth2 Authorization Servers list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -3381,6 +4888,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(AuthorizationServerCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -3392,65 +4907,69 @@ class AuthorizationServerContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Form of an authorization grant, which the client uses to request the access + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -3486,6 +5005,65 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authorization_methods = kwargs.get('authorization_methods', None) @@ -3508,41 +5086,43 @@ def __init__( class AuthorizationServerContractBaseProperties(msrest.serialization.Model): """External OAuth authorization server Update settings contract. - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str + :vartype resource_owner_password: str """ _attribute_map = { @@ -3562,6 +5142,47 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + """ super(AuthorizationServerContractBaseProperties, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authorization_methods = kwargs.get('authorization_methods', None) @@ -3580,59 +5201,61 @@ class AuthorizationServerContractProperties(AuthorizationServerContractBasePrope All required parameters must be populated in order to send to Azure. - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: Required. User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Required. Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: Required. User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Required. Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: Required. OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: Required. OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Required. Form of an authorization grant, which the client uses to request + :vartype authorization_endpoint: str + :ivar grant_types: Required. Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Required. Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Required. Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -3666,6 +5289,65 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: Required. User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Required. Optional reference to a page where client or + app registration for this authorization server is performed. Contains absolute URL to entity + being referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: Required. OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Required. Form of an authorization grant, which the client uses to + request the access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Required. Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] self.client_registration_endpoint = kwargs['client_registration_endpoint'] @@ -3678,14 +5360,14 @@ def __init__( class AuthorizationServerSecretsContract(msrest.serialization.Model): """OAuth Server Secrets Contract. - :param client_secret: oAuth Authorization Server Secrets. - :type client_secret: str - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar client_secret: oAuth Authorization Server Secrets. + :vartype client_secret: str + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str + :vartype resource_owner_password: str """ _attribute_map = { @@ -3698,6 +5380,16 @@ def __init__( self, **kwargs ): + """ + :keyword client_secret: oAuth Authorization Server Secrets. + :paramtype client_secret: str + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + """ super(AuthorizationServerSecretsContract, self).__init__(**kwargs) self.client_secret = kwargs.get('client_secret', None) self.resource_owner_username = kwargs.get('resource_owner_username', None) @@ -3709,65 +5401,69 @@ class AuthorizationServerUpdateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Form of an authorization grant, which the client uses to request the access + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -3803,6 +5499,65 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerUpdateContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.authorization_methods = kwargs.get('authorization_methods', None) @@ -3825,59 +5580,61 @@ def __init__( class AuthorizationServerUpdateContractProperties(AuthorizationServerContractBaseProperties): """External OAuth authorization server Update settings contract. - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Form of an authorization grant, which the client uses to request the access + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -3907,6 +5664,65 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerUpdateContractProperties, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.client_registration_endpoint = kwargs.get('client_registration_endpoint', None) @@ -3921,10 +5737,10 @@ class BackendAuthorizationHeaderCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scheme: Required. Authentication Scheme name. - :type scheme: str - :param parameter: Required. Authentication Parameter value. - :type parameter: str + :ivar scheme: Required. Authentication Scheme name. + :vartype scheme: str + :ivar parameter: Required. Authentication Parameter value. + :vartype parameter: str """ _validation = { @@ -3941,6 +5757,12 @@ def __init__( self, **kwargs ): + """ + :keyword scheme: Required. Authentication Scheme name. + :paramtype scheme: str + :keyword parameter: Required. Authentication Parameter value. + :paramtype parameter: str + """ super(BackendAuthorizationHeaderCredentials, self).__init__(**kwargs) self.scheme = kwargs['scheme'] self.parameter = kwargs['parameter'] @@ -3949,21 +5771,21 @@ def __init__( class BackendBaseParameters(msrest.serialization.Model): """Backend entity base Parameter set. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties """ _validation = { @@ -3986,6 +5808,23 @@ def __init__( self, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + """ super(BackendBaseParameters, self).__init__(**kwargs) self.title = kwargs.get('title', None) self.description = kwargs.get('description', None) @@ -3999,12 +5838,12 @@ def __init__( class BackendCollection(msrest.serialization.Model): """Paged Backend list representation. - :param value: Backend values. - :type value: list[~azure.mgmt.apimanagement.models.BackendContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Backend values. + :vartype value: list[~azure.mgmt.apimanagement.models.BackendContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -4017,6 +5856,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Backend values. + :paramtype value: list[~azure.mgmt.apimanagement.models.BackendContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(BackendCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -4028,31 +5875,33 @@ class BackendContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Runtime Url of the Backend. - :type url: str - :param protocol: Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Backend communication protocol. Possible values include: "http", "soap". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4084,6 +5933,27 @@ def __init__( self, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Backend communication protocol. Possible values include: "http", "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendContract, self).__init__(**kwargs) self.title = kwargs.get('title', None) self.description = kwargs.get('description', None) @@ -4101,26 +5971,26 @@ class BackendContractProperties(BackendBaseParameters): All required parameters must be populated in order to send to Azure. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Required. Runtime Url of the Backend. - :type url: str - :param protocol: Required. Backend communication protocol. Possible values include: "http", + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Required. Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Required. Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4147,6 +6017,28 @@ def __init__( self, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Required. Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Required. Backend communication protocol. Possible values include: "http", + "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendContractProperties, self).__init__(**kwargs) self.url = kwargs['url'] self.protocol = kwargs['protocol'] @@ -4155,17 +6047,17 @@ def __init__( class BackendCredentialsContract(msrest.serialization.Model): """Details of the Credentials used to connect to Backend. - :param certificate_ids: List of Client Certificate Ids. - :type certificate_ids: list[str] - :param certificate: List of Client Certificate Thumbprints. Will be ignored if certificatesIds + :ivar certificate_ids: List of Client Certificate Ids. + :vartype certificate_ids: list[str] + :ivar certificate: List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided. - :type certificate: list[str] - :param query: Query Parameter description. - :type query: dict[str, list[str]] - :param header: Header Parameter description. - :type header: dict[str, list[str]] - :param authorization: Authorization header authentication. - :type authorization: ~azure.mgmt.apimanagement.models.BackendAuthorizationHeaderCredentials + :vartype certificate: list[str] + :ivar query: Query Parameter description. + :vartype query: dict[str, list[str]] + :ivar header: Header Parameter description. + :vartype header: dict[str, list[str]] + :ivar authorization: Authorization header authentication. + :vartype authorization: ~azure.mgmt.apimanagement.models.BackendAuthorizationHeaderCredentials """ _validation = { @@ -4185,6 +6077,20 @@ def __init__( self, **kwargs ): + """ + :keyword certificate_ids: List of Client Certificate Ids. + :paramtype certificate_ids: list[str] + :keyword certificate: List of Client Certificate Thumbprints. Will be ignored if + certificatesIds are provided. + :paramtype certificate: list[str] + :keyword query: Query Parameter description. + :paramtype query: dict[str, list[str]] + :keyword header: Header Parameter description. + :paramtype header: dict[str, list[str]] + :keyword authorization: Authorization header authentication. + :paramtype authorization: + ~azure.mgmt.apimanagement.models.BackendAuthorizationHeaderCredentials + """ super(BackendCredentialsContract, self).__init__(**kwargs) self.certificate_ids = kwargs.get('certificate_ids', None) self.certificate = kwargs.get('certificate', None) @@ -4196,8 +6102,8 @@ def __init__( class BackendProperties(msrest.serialization.Model): """Properties specific to the Backend Type. - :param service_fabric_cluster: Backend Service Fabric Cluster Properties. - :type service_fabric_cluster: + :ivar service_fabric_cluster: Backend Service Fabric Cluster Properties. + :vartype service_fabric_cluster: ~azure.mgmt.apimanagement.models.BackendServiceFabricClusterProperties """ @@ -4209,6 +6115,11 @@ def __init__( self, **kwargs ): + """ + :keyword service_fabric_cluster: Backend Service Fabric Cluster Properties. + :paramtype service_fabric_cluster: + ~azure.mgmt.apimanagement.models.BackendServiceFabricClusterProperties + """ super(BackendProperties, self).__init__(**kwargs) self.service_fabric_cluster = kwargs.get('service_fabric_cluster', None) @@ -4218,13 +6129,13 @@ class BackendProxyContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. WebProxy Server AbsoluteUri property which includes the entire URI stored + :ivar url: Required. WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. - :type url: str - :param username: Username to connect to the WebProxy server. - :type username: str - :param password: Password to connect to the WebProxy Server. - :type password: str + :vartype url: str + :ivar username: Username to connect to the WebProxy server. + :vartype username: str + :ivar password: Password to connect to the WebProxy Server. + :vartype password: str """ _validation = { @@ -4241,6 +6152,15 @@ def __init__( self, **kwargs ): + """ + :keyword url: Required. WebProxy Server AbsoluteUri property which includes the entire URI + stored in the Uri instance, including all fragments and query strings. + :paramtype url: str + :keyword username: Username to connect to the WebProxy server. + :paramtype username: str + :keyword password: Password to connect to the WebProxy Server. + :paramtype password: str + """ super(BackendProxyContract, self).__init__(**kwargs) self.url = kwargs['url'] self.username = kwargs.get('username', None) @@ -4252,15 +6172,17 @@ class BackendReconnectContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param after: Duration in ISO8601 format after which reconnect will be initiated. Minimum + :ivar after: Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. - :type after: ~datetime.timedelta + :vartype after: ~datetime.timedelta """ _validation = { @@ -4280,6 +6202,11 @@ def __init__( self, **kwargs ): + """ + :keyword after: Duration in ISO8601 format after which reconnect will be initiated. Minimum + duration of the Reconnect is PT2M. + :paramtype after: ~datetime.timedelta + """ super(BackendReconnectContract, self).__init__(**kwargs) self.after = kwargs.get('after', None) @@ -4289,21 +6216,21 @@ class BackendServiceFabricClusterProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client_certificate_id: The client certificate id for the management endpoint. - :type client_certificate_id: str - :param client_certificatethumbprint: The client certificate thumbprint for the management + :ivar client_certificate_id: The client certificate id for the management endpoint. + :vartype client_certificate_id: str + :ivar client_certificatethumbprint: The client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided. - :type client_certificatethumbprint: str - :param max_partition_resolution_retries: Maximum number of retries while attempting resolve the + :vartype client_certificatethumbprint: str + :ivar max_partition_resolution_retries: Maximum number of retries while attempting resolve the partition. - :type max_partition_resolution_retries: int - :param management_endpoints: Required. The cluster management endpoint. - :type management_endpoints: list[str] - :param server_certificate_thumbprints: Thumbprints of certificates cluster management service + :vartype max_partition_resolution_retries: int + :ivar management_endpoints: Required. The cluster management endpoint. + :vartype management_endpoints: list[str] + :ivar server_certificate_thumbprints: Thumbprints of certificates cluster management service uses for tls communication. - :type server_certificate_thumbprints: list[str] - :param server_x509_names: Server X509 Certificate Names Collection. - :type server_x509_names: list[~azure.mgmt.apimanagement.models.X509CertificateName] + :vartype server_certificate_thumbprints: list[str] + :ivar server_x509_names: Server X509 Certificate Names Collection. + :vartype server_x509_names: list[~azure.mgmt.apimanagement.models.X509CertificateName] """ _validation = { @@ -4323,6 +6250,23 @@ def __init__( self, **kwargs ): + """ + :keyword client_certificate_id: The client certificate id for the management endpoint. + :paramtype client_certificate_id: str + :keyword client_certificatethumbprint: The client certificate thumbprint for the management + endpoint. Will be ignored if certificatesIds are provided. + :paramtype client_certificatethumbprint: str + :keyword max_partition_resolution_retries: Maximum number of retries while attempting resolve + the partition. + :paramtype max_partition_resolution_retries: int + :keyword management_endpoints: Required. The cluster management endpoint. + :paramtype management_endpoints: list[str] + :keyword server_certificate_thumbprints: Thumbprints of certificates cluster management service + uses for tls communication. + :paramtype server_certificate_thumbprints: list[str] + :keyword server_x509_names: Server X509 Certificate Names Collection. + :paramtype server_x509_names: list[~azure.mgmt.apimanagement.models.X509CertificateName] + """ super(BackendServiceFabricClusterProperties, self).__init__(**kwargs) self.client_certificate_id = kwargs.get('client_certificate_id', None) self.client_certificatethumbprint = kwargs.get('client_certificatethumbprint', None) @@ -4335,12 +6279,12 @@ def __init__( class BackendTlsProperties(msrest.serialization.Model): """Properties controlling TLS Certificate Validation. - :param validate_certificate_chain: Flag indicating whether SSL certificate chain validation - should be done when using self-signed certificates for this backend host. - :type validate_certificate_chain: bool - :param validate_certificate_name: Flag indicating whether SSL certificate name validation + :ivar validate_certificate_chain: Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. - :type validate_certificate_name: bool + :vartype validate_certificate_chain: bool + :ivar validate_certificate_name: Flag indicating whether SSL certificate name validation should + be done when using self-signed certificates for this backend host. + :vartype validate_certificate_name: bool """ _attribute_map = { @@ -4352,6 +6296,14 @@ def __init__( self, **kwargs ): + """ + :keyword validate_certificate_chain: Flag indicating whether SSL certificate chain validation + should be done when using self-signed certificates for this backend host. + :paramtype validate_certificate_chain: bool + :keyword validate_certificate_name: Flag indicating whether SSL certificate name validation + should be done when using self-signed certificates for this backend host. + :paramtype validate_certificate_name: bool + """ super(BackendTlsProperties, self).__init__(**kwargs) self.validate_certificate_chain = kwargs.get('validate_certificate_chain', True) self.validate_certificate_name = kwargs.get('validate_certificate_name', True) @@ -4360,25 +6312,25 @@ def __init__( class BackendUpdateParameterProperties(BackendBaseParameters): """Parameters supplied to the Update Backend operation. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Runtime Url of the Backend. - :type url: str - :param protocol: Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Backend communication protocol. Possible values include: "http", "soap". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4404,6 +6356,27 @@ def __init__( self, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Backend communication protocol. Possible values include: "http", "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendUpdateParameterProperties, self).__init__(**kwargs) self.url = kwargs.get('url', None) self.protocol = kwargs.get('protocol', None) @@ -4412,25 +6385,25 @@ def __init__( class BackendUpdateParameters(msrest.serialization.Model): """Backend update parameters. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Runtime Url of the Backend. - :type url: str - :param protocol: Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Backend communication protocol. Possible values include: "http", "soap". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4456,6 +6429,27 @@ def __init__( self, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Backend communication protocol. Possible values include: "http", "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendUpdateParameters, self).__init__(**kwargs) self.title = kwargs.get('title', None) self.description = kwargs.get('description', None) @@ -4471,8 +6465,8 @@ def __init__( class BodyDiagnosticSettings(msrest.serialization.Model): """Body logging settings. - :param bytes: Number of request body bytes to log. - :type bytes: int + :ivar bytes: Number of request body bytes to log. + :vartype bytes: int """ _validation = { @@ -4487,6 +6481,10 @@ def __init__( self, **kwargs ): + """ + :keyword bytes: Number of request body bytes to log. + :paramtype bytes: int + """ super(BodyDiagnosticSettings, self).__init__(**kwargs) self.bytes = kwargs.get('bytes', None) @@ -4494,12 +6492,12 @@ def __init__( class CacheCollection(msrest.serialization.Model): """Paged Caches list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.CacheContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.CacheContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -4512,6 +6510,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.CacheContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(CacheCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -4523,21 +6529,23 @@ class CacheContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Cache description. - :type description: str - :param connection_string: Runtime connection string to cache. - :type connection_string: str - :param use_from_location: Location identifier to use cache from (should be either 'default' or + :ivar description: Cache description. + :vartype description: str + :ivar connection_string: Runtime connection string to cache. + :vartype connection_string: str + :ivar use_from_location: Location identifier to use cache from (should be either 'default' or valid Azure region identifier). - :type use_from_location: str - :param resource_id: Original uri of entity in external system cache points to. - :type resource_id: str + :vartype use_from_location: str + :ivar resource_id: Original uri of entity in external system cache points to. + :vartype resource_id: str """ _validation = { @@ -4564,6 +6572,17 @@ def __init__( self, **kwargs ): + """ + :keyword description: Cache description. + :paramtype description: str + :keyword connection_string: Runtime connection string to cache. + :paramtype connection_string: str + :keyword use_from_location: Location identifier to use cache from (should be either 'default' + or valid Azure region identifier). + :paramtype use_from_location: str + :keyword resource_id: Original uri of entity in external system cache points to. + :paramtype resource_id: str + """ super(CacheContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.connection_string = kwargs.get('connection_string', None) @@ -4574,15 +6593,15 @@ def __init__( class CacheUpdateParameters(msrest.serialization.Model): """Cache update details. - :param description: Cache description. - :type description: str - :param connection_string: Runtime connection string to cache. - :type connection_string: str - :param use_from_location: Location identifier to use cache from (should be either 'default' or + :ivar description: Cache description. + :vartype description: str + :ivar connection_string: Runtime connection string to cache. + :vartype connection_string: str + :ivar use_from_location: Location identifier to use cache from (should be either 'default' or valid Azure region identifier). - :type use_from_location: str - :param resource_id: Original uri of entity in external system cache points to. - :type resource_id: str + :vartype use_from_location: str + :ivar resource_id: Original uri of entity in external system cache points to. + :vartype resource_id: str """ _validation = { @@ -4603,6 +6622,17 @@ def __init__( self, **kwargs ): + """ + :keyword description: Cache description. + :paramtype description: str + :keyword connection_string: Runtime connection string to cache. + :paramtype connection_string: str + :keyword use_from_location: Location identifier to use cache from (should be either 'default' + or valid Azure region identifier). + :paramtype use_from_location: str + :keyword resource_id: Original uri of entity in external system cache points to. + :paramtype resource_id: str + """ super(CacheUpdateParameters, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.connection_string = kwargs.get('connection_string', None) @@ -4613,12 +6643,12 @@ def __init__( class CertificateCollection(msrest.serialization.Model): """Paged Certificates list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.CertificateContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.CertificateContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -4631,6 +6661,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.CertificateContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(CertificateCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -4642,16 +6680,16 @@ class CertificateConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param encoded_certificate: Base64 Encoded certificate. - :type encoded_certificate: str - :param certificate_password: Certificate Password. - :type certificate_password: str - :param store_name: Required. The System.Security.Cryptography.x509certificates.StoreName + :ivar encoded_certificate: Base64 Encoded certificate. + :vartype encoded_certificate: str + :ivar certificate_password: Certificate Password. + :vartype certificate_password: str + :ivar store_name: Required. The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: "CertificateAuthority", "Root". - :type store_name: str or ~azure.mgmt.apimanagement.models.CertificateConfigurationStoreName - :param certificate: Certificate information. - :type certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :vartype store_name: str or ~azure.mgmt.apimanagement.models.CertificateConfigurationStoreName + :ivar certificate: Certificate information. + :vartype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation """ _validation = { @@ -4669,6 +6707,19 @@ def __init__( self, **kwargs ): + """ + :keyword encoded_certificate: Base64 Encoded certificate. + :paramtype encoded_certificate: str + :keyword certificate_password: Certificate Password. + :paramtype certificate_password: str + :keyword store_name: Required. The System.Security.Cryptography.x509certificates.StoreName + certificate store location. Only Root and CertificateAuthority are valid locations. Possible + values include: "CertificateAuthority", "Root". + :paramtype store_name: str or + ~azure.mgmt.apimanagement.models.CertificateConfigurationStoreName + :keyword certificate: Certificate information. + :paramtype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + """ super(CertificateConfiguration, self).__init__(**kwargs) self.encoded_certificate = kwargs.get('encoded_certificate', None) self.certificate_password = kwargs.get('certificate_password', None) @@ -4681,21 +6732,23 @@ class CertificateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param subject: Subject attribute of the certificate. - :type subject: str - :param thumbprint: Thumbprint of the certificate. - :type thumbprint: str - :param expiration_date: Expiration date of the certificate. The date conforms to the following + :ivar subject: Subject attribute of the certificate. + :vartype subject: str + :ivar thumbprint: Thumbprint of the certificate. + :vartype thumbprint: str + :ivar expiration_date: Expiration date of the certificate. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiration_date: ~datetime.datetime - :param key_vault: KeyVault location details of the certificate. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + :vartype expiration_date: ~datetime.datetime + :ivar key_vault: KeyVault location details of the certificate. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties """ _validation = { @@ -4718,6 +6771,17 @@ def __init__( self, **kwargs ): + """ + :keyword subject: Subject attribute of the certificate. + :paramtype subject: str + :keyword thumbprint: Thumbprint of the certificate. + :paramtype thumbprint: str + :keyword expiration_date: Expiration date of the certificate. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiration_date: ~datetime.datetime + :keyword key_vault: KeyVault location details of the certificate. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + """ super(CertificateContract, self).__init__(**kwargs) self.subject = kwargs.get('subject', None) self.thumbprint = kwargs.get('thumbprint', None) @@ -4728,12 +6792,12 @@ def __init__( class CertificateCreateOrUpdateParameters(msrest.serialization.Model): """Certificate create or update details. - :param data: Base 64 encoded certificate using the application/x-pkcs12 representation. - :type data: str - :param password: Password for the Certificate. - :type password: str - :param key_vault: KeyVault location details of the certificate. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :ivar data: Base 64 encoded certificate using the application/x-pkcs12 representation. + :vartype data: str + :ivar password: Password for the Certificate. + :vartype password: str + :ivar key_vault: KeyVault location details of the certificate. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _attribute_map = { @@ -4746,6 +6810,14 @@ def __init__( self, **kwargs ): + """ + :keyword data: Base 64 encoded certificate using the application/x-pkcs12 representation. + :paramtype data: str + :keyword password: Password for the Certificate. + :paramtype password: str + :keyword key_vault: KeyVault location details of the certificate. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(CertificateCreateOrUpdateParameters, self).__init__(**kwargs) self.data = kwargs.get('data', None) self.password = kwargs.get('password', None) @@ -4757,13 +6829,13 @@ class CertificateInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param expiry: Required. Expiration date of the certificate. The date conforms to the following + :ivar expiry: Required. Expiration date of the certificate. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiry: ~datetime.datetime - :param thumbprint: Required. Thumbprint of the certificate. - :type thumbprint: str - :param subject: Required. Subject of the certificate. - :type subject: str + :vartype expiry: ~datetime.datetime + :ivar thumbprint: Required. Thumbprint of the certificate. + :vartype thumbprint: str + :ivar subject: Required. Subject of the certificate. + :vartype subject: str """ _validation = { @@ -4782,6 +6854,15 @@ def __init__( self, **kwargs ): + """ + :keyword expiry: Required. Expiration date of the certificate. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiry: ~datetime.datetime + :keyword thumbprint: Required. Thumbprint of the certificate. + :paramtype thumbprint: str + :keyword subject: Required. Subject of the certificate. + :paramtype subject: str + """ super(CertificateInformation, self).__init__(**kwargs) self.expiry = kwargs['expiry'] self.thumbprint = kwargs['thumbprint'] @@ -4791,8 +6872,8 @@ def __init__( class ClientSecretContract(msrest.serialization.Model): """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - :param client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - :type client_secret: str + :ivar client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + :vartype client_secret: str """ _attribute_map = { @@ -4803,140 +6884,526 @@ def __init__( self, **kwargs ): + """ + :keyword client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + :paramtype client_secret: str + """ super(ClientSecretContract, self).__init__(**kwargs) self.client_secret = kwargs.get('client_secret', None) -class ConnectivityStatusContract(msrest.serialization.Model): - """Details about connectivity to a resource. +class ConnectivityCheckRequest(msrest.serialization.Model): + """A request to perform the connectivity check operation on a API Management service. All required parameters must be populated in order to send to Azure. - :param name: Required. The hostname of the resource which the service depends on. This can be - the database, storage or any other azure resource on which the service depends upon. - :type name: str - :param status: Required. Resource Connectivity Status Type identifier. Possible values include: - "initializing", "success", "failure". - :type status: str or ~azure.mgmt.apimanagement.models.ConnectivityStatusType - :param error: Error details of the connectivity to the resource. - :type error: str - :param last_updated: Required. The date when the resource connectivity status was last updated. - This status should be updated every 15 minutes. If this status has not been updated, then it - means that the service has lost network connectivity to the resource, from inside the Virtual - Network.The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the - ISO 8601 standard. - :type last_updated: ~datetime.datetime - :param last_status_change: Required. The date when the resource connectivity status last - Changed from success to failure or vice-versa. The date conforms to the following format: - ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type last_status_change: ~datetime.datetime - :param resource_type: Required. Resource Type. - :type resource_type: str - :param is_optional: Required. Whether this is optional. - :type is_optional: bool + :ivar source: Required. Definitions about the connectivity check origin. + :vartype source: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestSource + :ivar destination: Required. The connectivity check operation destination. + :vartype destination: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestDestination + :ivar preferred_ip_version: The IP version to be used. Only IPv4 is supported for now. Possible + values include: "IPv4". + :vartype preferred_ip_version: str or ~azure.mgmt.apimanagement.models.PreferredIPVersion + :ivar protocol: The request's protocol. Specific protocol configuration can be available based + on this selection. The specified destination address must be coherent with this value. Possible + values include: "TCP", "HTTP", "HTTPS". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.ConnectivityCheckProtocol + :ivar protocol_configuration: Protocol-specific configuration. + :vartype protocol_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfiguration """ _validation = { - 'name': {'required': True, 'min_length': 1}, - 'status': {'required': True}, - 'last_updated': {'required': True}, - 'last_status_change': {'required': True}, - 'resource_type': {'required': True}, - 'is_optional': {'required': True}, + 'source': {'required': True}, + 'destination': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'str'}, - 'last_updated': {'key': 'lastUpdated', 'type': 'iso-8601'}, - 'last_status_change': {'key': 'lastStatusChange', 'type': 'iso-8601'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'is_optional': {'key': 'isOptional', 'type': 'bool'}, + 'source': {'key': 'source', 'type': 'ConnectivityCheckRequestSource'}, + 'destination': {'key': 'destination', 'type': 'ConnectivityCheckRequestDestination'}, + 'preferred_ip_version': {'key': 'preferredIPVersion', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'protocol_configuration': {'key': 'protocolConfiguration', 'type': 'ConnectivityCheckRequestProtocolConfiguration'}, } def __init__( self, **kwargs ): - super(ConnectivityStatusContract, self).__init__(**kwargs) - self.name = kwargs['name'] - self.status = kwargs['status'] - self.error = kwargs.get('error', None) - self.last_updated = kwargs['last_updated'] - self.last_status_change = kwargs['last_status_change'] - self.resource_type = kwargs['resource_type'] - self.is_optional = kwargs['is_optional'] + """ + :keyword source: Required. Definitions about the connectivity check origin. + :paramtype source: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestSource + :keyword destination: Required. The connectivity check operation destination. + :paramtype destination: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestDestination + :keyword preferred_ip_version: The IP version to be used. Only IPv4 is supported for now. + Possible values include: "IPv4". + :paramtype preferred_ip_version: str or ~azure.mgmt.apimanagement.models.PreferredIPVersion + :keyword protocol: The request's protocol. Specific protocol configuration can be available + based on this selection. The specified destination address must be coherent with this value. + Possible values include: "TCP", "HTTP", "HTTPS". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.ConnectivityCheckProtocol + :keyword protocol_configuration: Protocol-specific configuration. + :paramtype protocol_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfiguration + """ + super(ConnectivityCheckRequest, self).__init__(**kwargs) + self.source = kwargs['source'] + self.destination = kwargs['destination'] + self.preferred_ip_version = kwargs.get('preferred_ip_version', None) + self.protocol = kwargs.get('protocol', None) + self.protocol_configuration = kwargs.get('protocol_configuration', None) -class ContentItemCollection(msrest.serialization.Model): - """Paged list of content items. +class ConnectivityCheckRequestDestination(msrest.serialization.Model): + """The connectivity check operation destination. - 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 value: Collection of content items. - :vartype value: list[~azure.mgmt.apimanagement.models.ContentItemContract] - :ivar next_link: Next page link, if any. - :vartype next_link: str + :ivar address: Required. Destination address. Can either be an IP address or a FQDN. + :vartype address: str + :ivar port: Required. Destination port. + :vartype port: long """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'address': {'required': True}, + 'port': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ContentItemContract]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'long'}, } def __init__( self, **kwargs ): - super(ContentItemCollection, self).__init__(**kwargs) - self.value = None - self.next_link = None - + """ + :keyword address: Required. Destination address. Can either be an IP address or a FQDN. + :paramtype address: str + :keyword port: Required. Destination port. + :paramtype port: long + """ + super(ConnectivityCheckRequestDestination, self).__init__(**kwargs) + self.address = kwargs['address'] + self.port = kwargs['port'] -class ContentItemContract(Resource): - """Content type contract details. - Variables are only populated by the server, and will be ignored when sending a request. +class ConnectivityCheckRequestProtocolConfiguration(msrest.serialization.Model): + """Protocol-specific configuration. - :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, any] + :ivar http_configuration: Configuration for HTTP or HTTPS requests. + :vartype http_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration """ - _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}'}, + 'http_configuration': {'key': 'HTTPConfiguration', 'type': 'ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration'}, } def __init__( self, **kwargs ): - super(ContentItemContract, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) + """ + :keyword http_configuration: Configuration for HTTP or HTTPS requests. + :paramtype http_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration + """ + super(ConnectivityCheckRequestProtocolConfiguration, self).__init__(**kwargs) + self.http_configuration = kwargs.get('http_configuration', None) -class ContentTypeCollection(msrest.serialization.Model): - """Paged list of content types. +class ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration(msrest.serialization.Model): + """Configuration for HTTP or HTTPS requests. + + :ivar method: The HTTP method to be used. Possible values include: "GET", "POST". + :vartype method: str or ~azure.mgmt.apimanagement.models.Method + :ivar valid_status_codes: List of HTTP status codes considered valid for the request response. + :vartype valid_status_codes: list[long] + :ivar headers: List of headers to be included in the request. + :vartype headers: list[~azure.mgmt.apimanagement.models.HTTPHeader] + """ + + _attribute_map = { + 'method': {'key': 'method', 'type': 'str'}, + 'valid_status_codes': {'key': 'validStatusCodes', 'type': '[long]'}, + 'headers': {'key': 'headers', 'type': '[HTTPHeader]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword method: The HTTP method to be used. Possible values include: "GET", "POST". + :paramtype method: str or ~azure.mgmt.apimanagement.models.Method + :keyword valid_status_codes: List of HTTP status codes considered valid for the request + response. + :paramtype valid_status_codes: list[long] + :keyword headers: List of headers to be included in the request. + :paramtype headers: list[~azure.mgmt.apimanagement.models.HTTPHeader] + """ + super(ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration, self).__init__(**kwargs) + self.method = kwargs.get('method', None) + self.valid_status_codes = kwargs.get('valid_status_codes', None) + self.headers = kwargs.get('headers', None) + + +class ConnectivityCheckRequestSource(msrest.serialization.Model): + """Definitions about the connectivity check origin. + + All required parameters must be populated in order to send to Azure. + + :ivar region: Required. The API Management service region from where to start the connectivity + check operation. + :vartype region: str + :ivar instance: The particular VMSS instance from which to fire the request. + :vartype instance: long + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + 'instance': {'key': 'instance', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword region: Required. The API Management service region from where to start the + connectivity check operation. + :paramtype region: str + :keyword instance: The particular VMSS instance from which to fire the request. + :paramtype instance: long + """ + super(ConnectivityCheckRequestSource, self).__init__(**kwargs) + self.region = kwargs['region'] + self.instance = kwargs.get('instance', None) + + +class ConnectivityCheckResponse(msrest.serialization.Model): + """Information on the connectivity status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hops: List of hops between the source and the destination. + :vartype hops: list[~azure.mgmt.apimanagement.models.ConnectivityHop] + :ivar connection_status: The connection status. Possible values include: "Unknown", + "Connected", "Disconnected", "Degraded". + :vartype connection_status: str or ~azure.mgmt.apimanagement.models.ConnectionStatus + :ivar avg_latency_in_ms: Average latency in milliseconds. + :vartype avg_latency_in_ms: long + :ivar min_latency_in_ms: Minimum latency in milliseconds. + :vartype min_latency_in_ms: long + :ivar max_latency_in_ms: Maximum latency in milliseconds. + :vartype max_latency_in_ms: long + :ivar probes_sent: Total number of probes sent. + :vartype probes_sent: long + :ivar probes_failed: Number of failed probes. + :vartype probes_failed: long + """ + + _validation = { + 'hops': {'readonly': True}, + 'connection_status': {'readonly': True}, + 'avg_latency_in_ms': {'readonly': True}, + 'min_latency_in_ms': {'readonly': True}, + 'max_latency_in_ms': {'readonly': True}, + 'probes_sent': {'readonly': True}, + 'probes_failed': {'readonly': True}, + } + + _attribute_map = { + 'hops': {'key': 'hops', 'type': '[ConnectivityHop]'}, + 'connection_status': {'key': 'connectionStatus', 'type': 'str'}, + 'avg_latency_in_ms': {'key': 'avgLatencyInMs', 'type': 'long'}, + 'min_latency_in_ms': {'key': 'minLatencyInMs', 'type': 'long'}, + 'max_latency_in_ms': {'key': 'maxLatencyInMs', 'type': 'long'}, + 'probes_sent': {'key': 'probesSent', 'type': 'long'}, + 'probes_failed': {'key': 'probesFailed', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConnectivityCheckResponse, self).__init__(**kwargs) + self.hops = None + self.connection_status = None + self.avg_latency_in_ms = None + self.min_latency_in_ms = None + self.max_latency_in_ms = None + self.probes_sent = None + self.probes_failed = None + + +class ConnectivityHop(msrest.serialization.Model): + """Information about a hop between the source and the destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the hop. + :vartype type: str + :ivar id: The ID of the hop. + :vartype id: str + :ivar address: The IP address of the hop. + :vartype address: str + :ivar resource_id: The ID of the resource corresponding to this hop. + :vartype resource_id: str + :ivar next_hop_ids: List of next hop identifiers. + :vartype next_hop_ids: list[str] + :ivar issues: List of issues. + :vartype issues: list[~azure.mgmt.apimanagement.models.ConnectivityIssue] + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'address': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'next_hop_ids': {'readonly': True}, + 'issues': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'next_hop_ids': {'key': 'nextHopIds', 'type': '[str]'}, + 'issues': {'key': 'issues', 'type': '[ConnectivityIssue]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConnectivityHop, self).__init__(**kwargs) + self.type = None + self.id = None + self.address = None + self.resource_id = None + self.next_hop_ids = None + self.issues = None + + +class ConnectivityIssue(msrest.serialization.Model): + """Information about an issue encountered in the process of checking for connectivity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the issue. Possible values include: "Local", "Inbound", "Outbound". + :vartype origin: str or ~azure.mgmt.apimanagement.models.Origin + :ivar severity: The severity of the issue. Possible values include: "Error", "Warning". + :vartype severity: str or ~azure.mgmt.apimanagement.models.Severity + :ivar type: The type of issue. Possible values include: "Unknown", "AgentStopped", + "GuestFirewall", "DnsResolution", "SocketBind", "NetworkSecurityRule", "UserDefinedRoute", + "PortThrottled", "Platform". + :vartype type: str or ~azure.mgmt.apimanagement.models.IssueType + :ivar context: Provides additional context on the issue. + :vartype context: list[dict[str, str]] + """ + + _validation = { + 'origin': {'readonly': True}, + 'severity': {'readonly': True}, + 'type': {'readonly': True}, + 'context': {'readonly': True}, + } + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'context': {'key': 'context', 'type': '[{str}]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConnectivityIssue, self).__init__(**kwargs) + self.origin = None + self.severity = None + self.type = None + self.context = None + + +class ConnectivityStatusContract(msrest.serialization.Model): + """Details about connectivity to a resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The hostname of the resource which the service depends on. This can be + the database, storage or any other azure resource on which the service depends upon. + :vartype name: str + :ivar status: Required. Resource Connectivity Status Type identifier. Possible values include: + "initializing", "success", "failure". + :vartype status: str or ~azure.mgmt.apimanagement.models.ConnectivityStatusType + :ivar error: Error details of the connectivity to the resource. + :vartype error: str + :ivar last_updated: Required. The date when the resource connectivity status was last updated. + This status should be updated every 15 minutes. If this status has not been updated, then it + means that the service has lost network connectivity to the resource, from inside the Virtual + Network.The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the + ISO 8601 standard. + :vartype last_updated: ~datetime.datetime + :ivar last_status_change: Required. The date when the resource connectivity status last Changed + from success to failure or vice-versa. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype last_status_change: ~datetime.datetime + :ivar resource_type: Required. Resource Type. + :vartype resource_type: str + :ivar is_optional: Required. Whether this is optional. + :vartype is_optional: bool + """ + + _validation = { + 'name': {'required': True, 'min_length': 1}, + 'status': {'required': True}, + 'last_updated': {'required': True}, + 'last_status_change': {'required': True}, + 'resource_type': {'required': True}, + 'is_optional': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'last_updated': {'key': 'lastUpdated', 'type': 'iso-8601'}, + 'last_status_change': {'key': 'lastStatusChange', 'type': 'iso-8601'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'is_optional': {'key': 'isOptional', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Required. The hostname of the resource which the service depends on. This can be + the database, storage or any other azure resource on which the service depends upon. + :paramtype name: str + :keyword status: Required. Resource Connectivity Status Type identifier. Possible values + include: "initializing", "success", "failure". + :paramtype status: str or ~azure.mgmt.apimanagement.models.ConnectivityStatusType + :keyword error: Error details of the connectivity to the resource. + :paramtype error: str + :keyword last_updated: Required. The date when the resource connectivity status was last + updated. This status should be updated every 15 minutes. If this status has not been updated, + then it means that the service has lost network connectivity to the resource, from inside the + Virtual Network.The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as + specified by the ISO 8601 standard. + :paramtype last_updated: ~datetime.datetime + :keyword last_status_change: Required. The date when the resource connectivity status last + Changed from success to failure or vice-versa. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype last_status_change: ~datetime.datetime + :keyword resource_type: Required. Resource Type. + :paramtype resource_type: str + :keyword is_optional: Required. Whether this is optional. + :paramtype is_optional: bool + """ + super(ConnectivityStatusContract, self).__init__(**kwargs) + self.name = kwargs['name'] + self.status = kwargs['status'] + self.error = kwargs.get('error', None) + self.last_updated = kwargs['last_updated'] + self.last_status_change = kwargs['last_status_change'] + self.resource_type = kwargs['resource_type'] + self.is_optional = kwargs['is_optional'] + + +class ContentItemCollection(msrest.serialization.Model): + """Paged list of content items. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of content items. + :vartype value: list[~azure.mgmt.apimanagement.models.ContentItemContract] + :ivar next_link: Next page link, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContentItemContract]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ContentItemCollection, self).__init__(**kwargs) + self.value = None + self.next_link = 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: 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar properties: Properties of the content item. + :vartype properties: dict[str, any] + """ + + _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 + ): + """ + :keyword properties: Properties of the content item. + :paramtype properties: dict[str, any] + """ + super(ContentItemContract, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ContentTypeCollection(msrest.serialization.Model): + """Paged list of content types. Variables are only populated by the server, and will be ignored when sending a request. @@ -4960,6 +7427,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentTypeCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4970,22 +7439,24 @@ class ContentTypeContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param id_properties_id: Content type identifier. - :type id_properties_id: str - :param name_properties_name: Content type name. Must be 1 to 250 characters long. - :type name_properties_name: str - :param description: Content type description. - :type description: str - :param schema: Content type schema. - :type schema: any - :param version: Content type version. - :type version: str + :ivar id_properties_id: Content type identifier. + :vartype id_properties_id: str + :ivar name_properties_name: Content type name. Must be 1 to 250 characters long. + :vartype name_properties_name: str + :ivar description: Content type description. + :vartype description: str + :ivar schema: Content type schema. + :vartype schema: any + :ivar version: Content type version. + :vartype version: str """ _validation = { @@ -5009,6 +7480,18 @@ def __init__( self, **kwargs ): + """ + :keyword id_properties_id: Content type identifier. + :paramtype id_properties_id: str + :keyword name_properties_name: Content type name. Must be 1 to 250 characters long. + :paramtype name_properties_name: str + :keyword description: Content type description. + :paramtype description: str + :keyword schema: Content type schema. + :paramtype schema: any + :keyword version: Content type version. + :paramtype version: str + """ super(ContentTypeContract, self).__init__(**kwargs) self.id_properties_id = kwargs.get('id_properties_id', None) self.name_properties_name = kwargs.get('name_properties_name', None) @@ -5020,10 +7503,10 @@ def __init__( class DataMasking(msrest.serialization.Model): """DataMasking. - :param query_params: Masking settings for Url query parameters. - :type query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] - :param headers: Masking settings for headers. - :type headers: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + :ivar query_params: Masking settings for Url query parameters. + :vartype query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + :ivar headers: Masking settings for headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] """ _attribute_map = { @@ -5035,6 +7518,12 @@ def __init__( self, **kwargs ): + """ + :keyword query_params: Masking settings for Url query parameters. + :paramtype query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + :keyword headers: Masking settings for headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + """ super(DataMasking, self).__init__(**kwargs) self.query_params = kwargs.get('query_params', None) self.headers = kwargs.get('headers', None) @@ -5043,10 +7532,10 @@ def __init__( class DataMaskingEntity(msrest.serialization.Model): """DataMaskingEntity. - :param value: The name of an entity to mask (e.g. a name of a header or a query parameter). - :type value: str - :param mode: Data masking mode. Possible values include: "Mask", "Hide". - :type mode: str or ~azure.mgmt.apimanagement.models.DataMaskingMode + :ivar value: The name of an entity to mask (e.g. a name of a header or a query parameter). + :vartype value: str + :ivar mode: Data masking mode. Possible values include: "Mask", "Hide". + :vartype mode: str or ~azure.mgmt.apimanagement.models.DataMaskingMode """ _attribute_map = { @@ -5058,33 +7547,41 @@ def __init__( self, **kwargs ): + """ + :keyword value: The name of an entity to mask (e.g. a name of a header or a query parameter). + :paramtype value: str + :keyword mode: Data masking mode. Possible values include: "Mask", "Hide". + :paramtype mode: str or ~azure.mgmt.apimanagement.models.DataMaskingMode + """ super(DataMaskingEntity, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.mode = kwargs.get('mode', None) class DeletedServiceContract(Resource): - """Deleted Api Management Service information. + """Deleted API Management Service information. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Api Management Service Master Location. + :ivar location: API Management Service Master Location. :vartype location: str - :param service_id: Fully-qualified API Management Service Resource ID. - :type service_id: str - :param scheduled_purge_date: UTC Date and Time when the service will be automatically purged. + :ivar service_id: Fully-qualified API Management Service Resource ID. + :vartype service_id: str + :ivar scheduled_purge_date: UTC Date and Time when the service will be automatically purged. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :type scheduled_purge_date: ~datetime.datetime - :param deletion_date: UTC Timestamp when the service was soft-deleted. The date conforms to the + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deletion_date: UTC Timestamp when the service was soft-deleted. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :type deletion_date: ~datetime.datetime + :vartype deletion_date: ~datetime.datetime """ _validation = { @@ -5108,6 +7605,17 @@ def __init__( self, **kwargs ): + """ + :keyword service_id: Fully-qualified API Management Service Resource ID. + :paramtype service_id: str + :keyword scheduled_purge_date: UTC Date and Time when the service will be automatically purged. + The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 + standard. + :paramtype scheduled_purge_date: ~datetime.datetime + :keyword deletion_date: UTC Timestamp when the service was soft-deleted. The date conforms to + the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + :paramtype deletion_date: ~datetime.datetime + """ super(DeletedServiceContract, self).__init__(**kwargs) self.location = None self.service_id = kwargs.get('service_id', None) @@ -5116,7 +7624,7 @@ def __init__( class DeletedServicesCollection(msrest.serialization.Model): - """Paged deleted Api Management Services List Representation. + """Paged deleted API Management Services List Representation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5140,6 +7648,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedServicesCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5148,12 +7658,12 @@ def __init__( class DeployConfigurationParameters(msrest.serialization.Model): """Deploy Tenant Configuration Contract. - :param branch: The name of the Git branch from which the configuration is to be deployed to the + :ivar branch: The name of the Git branch from which the configuration is to be deployed to the configuration database. - :type branch: str - :param force: The value enforcing deleting subscriptions to products that are deleted in this + :vartype branch: str + :ivar force: The value enforcing deleting subscriptions to products that are deleted in this update. - :type force: bool + :vartype force: bool """ _attribute_map = { @@ -5165,6 +7675,14 @@ def __init__( self, **kwargs ): + """ + :keyword branch: The name of the Git branch from which the configuration is to be deployed to + the configuration database. + :paramtype branch: str + :keyword force: The value enforcing deleting subscriptions to products that are deleted in this + update. + :paramtype force: bool + """ super(DeployConfigurationParameters, self).__init__(**kwargs) self.branch = kwargs.get('branch', None) self.force = kwargs.get('force', None) @@ -5173,12 +7691,12 @@ def __init__( class DiagnosticCollection(msrest.serialization.Model): """Paged Diagnostic list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5191,6 +7709,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(DiagnosticCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -5202,35 +7728,37 @@ class DiagnosticContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param always_log: Specifies for what type of messages sampling settings should not apply. + :ivar always_log: Specifies for what type of messages sampling settings should not apply. Possible values include: "allErrors". - :type always_log: str or ~azure.mgmt.apimanagement.models.AlwaysLog - :param logger_id: Resource Id of a target logger. - :type logger_id: str - :param sampling: Sampling settings for Diagnostic. - :type sampling: ~azure.mgmt.apimanagement.models.SamplingSettings - :param frontend: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - :type frontend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings - :param backend: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. - :type backend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings - :param log_client_ip: Log the ClientIP. Default is false. - :type log_client_ip: bool - :param http_correlation_protocol: Sets correlation protocol to use for Application Insights + :vartype always_log: str or ~azure.mgmt.apimanagement.models.AlwaysLog + :ivar logger_id: Resource Id of a target logger. + :vartype logger_id: str + :ivar sampling: Sampling settings for Diagnostic. + :vartype sampling: ~azure.mgmt.apimanagement.models.SamplingSettings + :ivar frontend: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + :vartype frontend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :ivar backend: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. + :vartype backend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :ivar log_client_ip: Log the ClientIP. Default is false. + :vartype log_client_ip: bool + :ivar http_correlation_protocol: Sets correlation protocol to use for Application Insights diagnostics. Possible values include: "None", "Legacy", "W3C". - :type http_correlation_protocol: str or + :vartype http_correlation_protocol: str or ~azure.mgmt.apimanagement.models.HttpCorrelationProtocol - :param verbosity: The verbosity level applied to traces emitted by trace policies. Possible + :ivar verbosity: The verbosity level applied to traces emitted by trace policies. Possible values include: "verbose", "information", "error". - :type verbosity: str or ~azure.mgmt.apimanagement.models.Verbosity - :param operation_name_format: The format of the Operation Name for Application Insights + :vartype verbosity: str or ~azure.mgmt.apimanagement.models.Verbosity + :ivar operation_name_format: The format of the Operation Name for Application Insights telemetries. Default is Name. Possible values include: "Name", "Url". - :type operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat + :vartype operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat """ _validation = { @@ -5258,6 +7786,31 @@ def __init__( self, **kwargs ): + """ + :keyword always_log: Specifies for what type of messages sampling settings should not apply. + Possible values include: "allErrors". + :paramtype always_log: str or ~azure.mgmt.apimanagement.models.AlwaysLog + :keyword logger_id: Resource Id of a target logger. + :paramtype logger_id: str + :keyword sampling: Sampling settings for Diagnostic. + :paramtype sampling: ~azure.mgmt.apimanagement.models.SamplingSettings + :keyword frontend: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + :paramtype frontend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :keyword backend: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. + :paramtype backend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :keyword log_client_ip: Log the ClientIP. Default is false. + :paramtype log_client_ip: bool + :keyword http_correlation_protocol: Sets correlation protocol to use for Application Insights + diagnostics. Possible values include: "None", "Legacy", "W3C". + :paramtype http_correlation_protocol: str or + ~azure.mgmt.apimanagement.models.HttpCorrelationProtocol + :keyword verbosity: The verbosity level applied to traces emitted by trace policies. Possible + values include: "verbose", "information", "error". + :paramtype verbosity: str or ~azure.mgmt.apimanagement.models.Verbosity + :keyword operation_name_format: The format of the Operation Name for Application Insights + telemetries. Default is Name. Possible values include: "Name", "Url". + :paramtype operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat + """ super(DiagnosticContract, self).__init__(**kwargs) self.always_log = kwargs.get('always_log', None) self.logger_id = kwargs.get('logger_id', None) @@ -5273,12 +7826,12 @@ def __init__( class EmailTemplateCollection(msrest.serialization.Model): """Paged email template list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5291,6 +7844,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(EmailTemplateCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -5302,25 +7863,27 @@ class EmailTemplateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param subject: Subject of the Template. - :type subject: str - :param body: Email Template Body. This should be a valid XDocument. - :type body: str - :param title: Title of the Template. - :type title: str - :param description: Description of the Email Template. - :type description: str - :ivar is_default: Whether the template is the default template provided by Api Management or + :ivar subject: Subject of the Template. + :vartype subject: str + :ivar body: Email Template Body. This should be a valid XDocument. + :vartype body: str + :ivar title: Title of the Template. + :vartype title: str + :ivar description: Description of the Email Template. + :vartype description: str + :ivar is_default: Whether the template is the default template provided by API Management or has been edited. :vartype is_default: bool - :param parameters: Email Template Parameter values. - :type parameters: + :ivar parameters: Email Template Parameter values. + :vartype parameters: list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] """ @@ -5349,6 +7912,19 @@ def __init__( self, **kwargs ): + """ + :keyword subject: Subject of the Template. + :paramtype subject: str + :keyword body: Email Template Body. This should be a valid XDocument. + :paramtype body: str + :keyword title: Title of the Template. + :paramtype title: str + :keyword description: Description of the Email Template. + :paramtype description: str + :keyword parameters: Email Template Parameter values. + :paramtype parameters: + list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] + """ super(EmailTemplateContract, self).__init__(**kwargs) self.subject = kwargs.get('subject', None) self.body = kwargs.get('body', None) @@ -5361,12 +7937,12 @@ def __init__( class EmailTemplateParametersContractProperties(msrest.serialization.Model): """Email Template Parameter contract. - :param name: Template parameter name. - :type name: str - :param title: Template parameter title. - :type title: str - :param description: Template parameter description. - :type description: str + :ivar name: Template parameter name. + :vartype name: str + :ivar title: Template parameter title. + :vartype title: str + :ivar description: Template parameter description. + :vartype description: str """ _validation = { @@ -5385,6 +7961,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Template parameter name. + :paramtype name: str + :keyword title: Template parameter title. + :paramtype title: str + :keyword description: Template parameter description. + :paramtype description: str + """ super(EmailTemplateParametersContractProperties, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.title = kwargs.get('title', None) @@ -5394,16 +7978,16 @@ def __init__( class EmailTemplateUpdateParameters(msrest.serialization.Model): """Email Template update Parameters. - :param subject: Subject of the Template. - :type subject: str - :param title: Title of the Template. - :type title: str - :param description: Description of the Email Template. - :type description: str - :param body: Email Template Body. This should be a valid XDocument. - :type body: str - :param parameters: Email Template Parameter values. - :type parameters: + :ivar subject: Subject of the Template. + :vartype subject: str + :ivar title: Title of the Template. + :vartype title: str + :ivar description: Description of the Email Template. + :vartype description: str + :ivar body: Email Template Body. This should be a valid XDocument. + :vartype body: str + :ivar parameters: Email Template Parameter values. + :vartype parameters: list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] """ @@ -5424,6 +8008,19 @@ def __init__( self, **kwargs ): + """ + :keyword subject: Subject of the Template. + :paramtype subject: str + :keyword title: Title of the Template. + :paramtype title: str + :keyword description: Description of the Email Template. + :paramtype description: str + :keyword body: Email Template Body. This should be a valid XDocument. + :paramtype body: str + :keyword parameters: Email Template Parameter values. + :paramtype parameters: + list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] + """ super(EmailTemplateUpdateParameters, self).__init__(**kwargs) self.subject = kwargs.get('subject', None) self.title = kwargs.get('title', None) @@ -5432,71 +8029,146 @@ def __init__( self.parameters = kwargs.get('parameters', None) -class ErrorFieldContract(msrest.serialization.Model): - """Error Field contract. +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at. - :param code: Property level error code. - :type code: str - :param message: Human-readable representation of property-level error. - :type message: str - :param target: Property name. - :type target: str + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports used when connecting to DomainName. + :vartype endpoint_details: list[~azure.mgmt.apimanagement.models.EndpointDetail] """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, } def __init__( self, **kwargs ): - super(ErrorFieldContract, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports used when connecting to DomainName. + :paramtype endpoint_details: list[~azure.mgmt.apimanagement.models.EndpointDetail] + """ + super(EndpointDependency, self).__init__(**kwargs) + self.domain_name = kwargs.get('domain_name', None) + self.endpoint_details = kwargs.get('endpoint_details', None) -class ErrorResponse(msrest.serialization.Model): - """Error Response. +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the Api Management Service to a single endpoint. - :param code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :type code: str - :param message: Human-readable representation of the error. - :type message: str - :param details: The list of invalid fields send in request, in case of validation error. - :type details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar region: The region of the dependency. + :vartype region: str """ _attribute_map = { - 'code': {'key': 'error.code', 'type': 'str'}, - 'message': {'key': 'error.message', 'type': 'str'}, - 'details': {'key': 'error.details', 'type': '[ErrorFieldContract]'}, + 'port': {'key': 'port', 'type': 'int'}, + 'region': {'key': 'region', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.details = kwargs.get('details', None) + """ + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword region: The region of the dependency. + :paramtype region: str + """ + super(EndpointDetail, self).__init__(**kwargs) + self.port = kwargs.get('port', None) + self.region = kwargs.get('region', None) -class ErrorResponseBody(msrest.serialization.Model): - """Error Body contract. +class ErrorFieldContract(msrest.serialization.Model): + """Error Field contract. - :param code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :type code: str - :param message: Human-readable representation of the error. - :type message: str - :param details: The list of invalid fields send in request, in case of validation error. - :type details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: Property level error code. + :paramtype code: str + :keyword message: Human-readable representation of property-level error. + :paramtype message: str + :keyword target: Property name. + :paramtype target: str + """ + super(ErrorFieldContract, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + + +class ErrorResponse(msrest.serialization.Model): + """Error Response. + + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + """ + + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[ErrorFieldContract]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + """ + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + + +class ErrorResponseBody(msrest.serialization.Model): + """Error Body contract. + + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] """ _attribute_map = { @@ -5509,6 +8181,15 @@ def __init__( self, **kwargs ): + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -5540,6 +8221,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayCertificateAuthorityCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5550,14 +8233,16 @@ class GatewayCertificateAuthorityContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param is_trusted: Determines whether certificate authority is trusted. - :type is_trusted: bool + :ivar is_trusted: Determines whether certificate authority is trusted. + :vartype is_trusted: bool """ _validation = { @@ -5577,6 +8262,10 @@ def __init__( self, **kwargs ): + """ + :keyword is_trusted: Determines whether certificate authority is trusted. + :paramtype is_trusted: bool + """ super(GatewayCertificateAuthorityContract, self).__init__(**kwargs) self.is_trusted = kwargs.get('is_trusted', None) @@ -5588,8 +8277,8 @@ class GatewayCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.GatewayContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -5609,6 +8298,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(GatewayCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -5620,16 +8313,18 @@ class GatewayContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location_data: Gateway location. - :type location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract - :param description: Gateway description. - :type description: str + :ivar location_data: Gateway location. + :vartype location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract + :ivar description: Gateway description. + :vartype description: str """ _validation = { @@ -5651,6 +8346,12 @@ def __init__( self, **kwargs ): + """ + :keyword location_data: Gateway location. + :paramtype location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract + :keyword description: Gateway description. + :paramtype description: str + """ super(GatewayContract, self).__init__(**kwargs) self.location_data = kwargs.get('location_data', None) self.description = kwargs.get('description', None) @@ -5681,6 +8382,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayHostnameConfigurationCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5691,25 +8394,27 @@ class GatewayHostnameConfigurationContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param hostname: Hostname value. Supports valid domain name, partial or full wildcard. - :type hostname: str - :param certificate_id: Identifier of Certificate entity that will be used for TLS connection + :ivar hostname: Hostname value. Supports valid domain name, partial or full wildcard. + :vartype hostname: str + :ivar certificate_id: Identifier of Certificate entity that will be used for TLS connection establishment. - :type certificate_id: str - :param negotiate_client_certificate: Determines whether gateway requests client certificate. - :type negotiate_client_certificate: bool - :param tls10_enabled: Specifies if TLS 1.0 is supported. - :type tls10_enabled: bool - :param tls11_enabled: Specifies if TLS 1.1 is supported. - :type tls11_enabled: bool - :param http2_enabled: Specifies if HTTP/2.0 is supported. - :type http2_enabled: bool + :vartype certificate_id: str + :ivar negotiate_client_certificate: Determines whether gateway requests client certificate. + :vartype negotiate_client_certificate: bool + :ivar tls10_enabled: Specifies if TLS 1.0 is supported. + :vartype tls10_enabled: bool + :ivar tls11_enabled: Specifies if TLS 1.1 is supported. + :vartype tls11_enabled: bool + :ivar http2_enabled: Specifies if HTTP/2.0 is supported. + :vartype http2_enabled: bool """ _validation = { @@ -5734,6 +8439,21 @@ def __init__( self, **kwargs ): + """ + :keyword hostname: Hostname value. Supports valid domain name, partial or full wildcard. + :paramtype hostname: str + :keyword certificate_id: Identifier of Certificate entity that will be used for TLS connection + establishment. + :paramtype certificate_id: str + :keyword negotiate_client_certificate: Determines whether gateway requests client certificate. + :paramtype negotiate_client_certificate: bool + :keyword tls10_enabled: Specifies if TLS 1.0 is supported. + :paramtype tls10_enabled: bool + :keyword tls11_enabled: Specifies if TLS 1.1 is supported. + :paramtype tls11_enabled: bool + :keyword http2_enabled: Specifies if HTTP/2.0 is supported. + :paramtype http2_enabled: bool + """ super(GatewayHostnameConfigurationContract, self).__init__(**kwargs) self.hostname = kwargs.get('hostname', None) self.certificate_id = kwargs.get('certificate_id', None) @@ -5748,9 +8468,9 @@ class GatewayKeyRegenerationRequestContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. The Key being regenerated. Possible values include: "primary", + :ivar key_type: Required. The Key being regenerated. Possible values include: "primary", "secondary". - :type key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :vartype key_type: str or ~azure.mgmt.apimanagement.models.KeyType """ _validation = { @@ -5765,6 +8485,11 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: Required. The Key being regenerated. Possible values include: "primary", + "secondary". + :paramtype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + """ super(GatewayKeyRegenerationRequestContract, self).__init__(**kwargs) self.key_type = kwargs['key_type'] @@ -5772,10 +8497,10 @@ def __init__( class GatewayKeysContract(msrest.serialization.Model): """Gateway authentication keys. - :param primary: Primary gateway key. - :type primary: str - :param secondary: Secondary gateway key. - :type secondary: str + :ivar primary: Primary gateway key. + :vartype primary: str + :ivar secondary: Secondary gateway key. + :vartype secondary: str """ _attribute_map = { @@ -5787,6 +8512,12 @@ def __init__( self, **kwargs ): + """ + :keyword primary: Primary gateway key. + :paramtype primary: str + :keyword secondary: Secondary gateway key. + :paramtype secondary: str + """ super(GatewayKeysContract, self).__init__(**kwargs) self.primary = kwargs.get('primary', None) self.secondary = kwargs.get('secondary', None) @@ -5795,8 +8526,8 @@ def __init__( class GatewayTokenContract(msrest.serialization.Model): """Gateway access token. - :param value: Shared Access Authentication token value for the Gateway. - :type value: str + :ivar value: Shared Access Authentication token value for the Gateway. + :vartype value: str """ _attribute_map = { @@ -5807,6 +8538,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Shared Access Authentication token value for the Gateway. + :paramtype value: str + """ super(GatewayTokenContract, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -5816,13 +8551,13 @@ class GatewayTokenRequestContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. The Key to be used to generate gateway token. Possible values + :ivar key_type: Required. The Key to be used to generate gateway token. Possible values include: "primary", "secondary". - :type key_type: str or ~azure.mgmt.apimanagement.models.KeyType - :param expiry: Required. The Expiry time of the Token. Maximum token expiry time is set to 30 + :vartype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :ivar expiry: Required. The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiry: ~datetime.datetime + :vartype expiry: ~datetime.datetime """ _validation = { @@ -5839,6 +8574,15 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: Required. The Key to be used to generate gateway token. Possible values + include: "primary", "secondary". + :paramtype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :keyword expiry: Required. The Expiry time of the Token. Maximum token expiry time is set to 30 + days. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the + ISO 8601 standard. + :paramtype expiry: ~datetime.datetime + """ super(GatewayTokenRequestContract, self).__init__(**kwargs) self.key_type = kwargs['key_type'] self.expiry = kwargs['expiry'] @@ -5847,8 +8591,8 @@ def __init__( class GenerateSsoUrlResult(msrest.serialization.Model): """Generate SSO Url operations response details. - :param value: Redirect Url containing the SSO URL value. - :type value: str + :ivar value: Redirect Url containing the SSO URL value. + :vartype value: str """ _attribute_map = { @@ -5859,19 +8603,122 @@ def __init__( self, **kwargs ): + """ + :keyword value: Redirect Url containing the SSO URL value. + :paramtype value: str + """ super(GenerateSsoUrlResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) +class GlobalSchemaCollection(msrest.serialization.Model): + """The response of the list schema operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Global Schema Contract value. + :vartype value: list[~azure.mgmt.apimanagement.models.GlobalSchemaContract] + :ivar count: Total record count number. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GlobalSchemaContract]'}, + 'count': {'key': 'count', 'type': 'long'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword count: Total record count number. + :paramtype count: long + """ + super(GlobalSchemaCollection, self).__init__(**kwargs) + self.value = None + self.count = kwargs.get('count', None) + self.next_link = None + + +class GlobalSchemaContract(Resource): + """Global Schema Contract details. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar schema_type: Schema Type. Immutable. Possible values include: "xml", "json". + :vartype schema_type: str or ~azure.mgmt.apimanagement.models.SchemaType + :ivar description: Free-form schema entity description. + :vartype description: str + :ivar value: Json-encoded string for non json-based schema. + :vartype value: any + :ivar document: Global Schema document object for json-based schema formats(e.g. json schema). + :vartype document: any + """ + + _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'}, + 'schema_type': {'key': 'properties.schemaType', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'object'}, + 'document': {'key': 'properties.document', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword schema_type: Schema Type. Immutable. Possible values include: "xml", "json". + :paramtype schema_type: str or ~azure.mgmt.apimanagement.models.SchemaType + :keyword description: Free-form schema entity description. + :paramtype description: str + :keyword value: Json-encoded string for non json-based schema. + :paramtype value: any + :keyword document: Global Schema document object for json-based schema formats(e.g. json + schema). + :paramtype document: any + """ + super(GlobalSchemaContract, self).__init__(**kwargs) + self.schema_type = kwargs.get('schema_type', None) + self.description = kwargs.get('description', None) + self.value = kwargs.get('value', None) + self.document = kwargs.get('document', None) + + class GroupCollection(msrest.serialization.Model): """Paged Group list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.GroupContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.GroupContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5884,6 +8731,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.GroupContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(GroupCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -5895,26 +8750,28 @@ class GroupContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param display_name: Group name. - :type display_name: str - :param description: Group description. Can contain HTML formatting tags. - :type description: str + :ivar display_name: Group name. + :vartype display_name: str + :ivar description: Group description. Can contain HTML formatting tags. + :vartype description: str :ivar built_in: true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. :vartype built_in: bool - :param type_properties_type: Group type. Possible values include: "custom", "system", + :ivar type_properties_type: Group type. Possible values include: "custom", "system", "external". - :type type_properties_type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: For external groups, this property contains the id of the group from the + :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -5941,6 +8798,19 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Group name. + :paramtype display_name: str + :keyword description: Group description. Can contain HTML formatting tags. + :paramtype description: str + :keyword type_properties_type: Group type. Possible values include: "custom", "system", + "external". + :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: For external groups, this property contains the id of the group from the + external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupContract, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -5956,19 +8826,19 @@ class GroupContractProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param display_name: Required. Group name. - :type display_name: str - :param description: Group description. Can contain HTML formatting tags. - :type description: str + :ivar display_name: Required. Group name. + :vartype display_name: str + :ivar description: Group description. Can contain HTML formatting tags. + :vartype description: str :ivar built_in: true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. :vartype built_in: bool - :param type: Group type. Possible values include: "custom", "system", "external". - :type type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: For external groups, this property contains the id of the group from the + :ivar type: Group type. Possible values include: "custom", "system", "external". + :vartype type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -5989,6 +8859,18 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Required. Group name. + :paramtype display_name: str + :keyword description: Group description. Can contain HTML formatting tags. + :paramtype description: str + :keyword type: Group type. Possible values include: "custom", "system", "external". + :paramtype type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: For external groups, this property contains the id of the group from the + external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] self.description = kwargs.get('description', None) @@ -6000,16 +8882,16 @@ def __init__( class GroupCreateParameters(msrest.serialization.Model): """Parameters supplied to the Create Group operation. - :param display_name: Group name. - :type display_name: str - :param description: Group description. - :type description: str - :param type: Group type. Possible values include: "custom", "system", "external". - :type type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: Identifier of the external groups, this property contains the id of the + :ivar display_name: Group name. + :vartype display_name: str + :ivar description: Group description. + :vartype description: str + :ivar type: Group type. Possible values include: "custom", "system", "external". + :vartype type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -6027,6 +8909,18 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Group name. + :paramtype display_name: str + :keyword description: Group description. + :paramtype description: str + :keyword type: Group type. Possible values include: "custom", "system", "external". + :paramtype type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: Identifier of the external groups, this property contains the id of the + group from the external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupCreateParameters, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -6037,16 +8931,16 @@ def __init__( class GroupUpdateParameters(msrest.serialization.Model): """Parameters supplied to the Update Group operation. - :param display_name: Group name. - :type display_name: str - :param description: Group description. - :type description: str - :param type: Group type. Possible values include: "custom", "system", "external". - :type type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: Identifier of the external groups, this property contains the id of the + :ivar display_name: Group name. + :vartype display_name: str + :ivar description: Group description. + :vartype description: str + :ivar type: Group type. Possible values include: "custom", "system", "external". + :vartype type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -6064,6 +8958,18 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Group name. + :paramtype display_name: str + :keyword description: Group description. + :paramtype description: str + :keyword type: Group type. Possible values include: "custom", "system", "external". + :paramtype type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: Identifier of the external groups, this property contains the id of the + group from the external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupUpdateParameters, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -6076,34 +8982,40 @@ class HostnameConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Hostname type. Possible values include: "Proxy", "Portal", "Management", + :ivar type: Required. Hostname type. Possible values include: "Proxy", "Portal", "Management", "Scm", "DeveloperPortal". - :type type: str or ~azure.mgmt.apimanagement.models.HostnameType - :param host_name: Required. Hostname to configure on the Api Management service. - :type host_name: str - :param key_vault_id: Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url + :vartype type: str or ~azure.mgmt.apimanagement.models.HostnameType + :ivar host_name: Required. Hostname to configure on the Api Management service. + :vartype host_name: str + :ivar key_vault_id: Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with aka.ms/apimmsi. The secret should be of type *application/x-pkcs12*. - :type key_vault_id: str - :param identity_client_id: System or User Assigned Managed identity clientId as generated by + :vartype key_vault_id: str + :ivar identity_client_id: System or User Assigned Managed identity clientId as generated by Azure AD, which has GET access to the keyVault containing the SSL certificate. - :type identity_client_id: str - :param encoded_certificate: Base64 Encoded certificate. - :type encoded_certificate: str - :param certificate_password: Certificate Password. - :type certificate_password: str - :param default_ssl_binding: Specify true to setup the certificate associated with this Hostname + :vartype identity_client_id: str + :ivar encoded_certificate: Base64 Encoded certificate. + :vartype encoded_certificate: str + :ivar certificate_password: Certificate Password. + :vartype certificate_password: str + :ivar default_ssl_binding: Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. - :type default_ssl_binding: bool - :param negotiate_client_certificate: Specify true to always negotiate client certificate on the + :vartype default_ssl_binding: bool + :ivar negotiate_client_certificate: Specify true to always negotiate client certificate on the hostname. Default Value is false. - :type negotiate_client_certificate: bool - :param certificate: Certificate information. - :type certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :vartype negotiate_client_certificate: bool + :ivar certificate: Certificate information. + :vartype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :ivar certificate_source: Certificate Source. Possible values include: "Managed", "KeyVault", + "Custom", "BuiltIn". + :vartype certificate_source: str or ~azure.mgmt.apimanagement.models.CertificateSource + :ivar certificate_status: Certificate Status. Possible values include: "Completed", "Failed", + "InProgress". + :vartype certificate_status: str or ~azure.mgmt.apimanagement.models.CertificateStatus """ _validation = { @@ -6121,12 +9033,50 @@ class HostnameConfiguration(msrest.serialization.Model): 'default_ssl_binding': {'key': 'defaultSslBinding', 'type': 'bool'}, 'negotiate_client_certificate': {'key': 'negotiateClientCertificate', 'type': 'bool'}, 'certificate': {'key': 'certificate', 'type': 'CertificateInformation'}, - } - - def __init__( - self, - **kwargs - ): + 'certificate_source': {'key': 'certificateSource', 'type': 'str'}, + 'certificate_status': {'key': 'certificateStatus', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword type: Required. Hostname type. Possible values include: "Proxy", "Portal", + "Management", "Scm", "DeveloperPortal". + :paramtype type: str or ~azure.mgmt.apimanagement.models.HostnameType + :keyword host_name: Required. Hostname to configure on the Api Management service. + :paramtype host_name: str + :keyword key_vault_id: Url to the KeyVault Secret containing the Ssl Certificate. If absolute + Url containing version is provided, auto-update of ssl certificate will not work. This requires + Api Management service to be configured with aka.ms/apimmsi. The secret should be of type + *application/x-pkcs12*. + :paramtype key_vault_id: str + :keyword identity_client_id: System or User Assigned Managed identity clientId as generated by + Azure AD, which has GET access to the keyVault containing the SSL certificate. + :paramtype identity_client_id: str + :keyword encoded_certificate: Base64 Encoded certificate. + :paramtype encoded_certificate: str + :keyword certificate_password: Certificate Password. + :paramtype certificate_password: str + :keyword default_ssl_binding: Specify true to setup the certificate associated with this + Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this + will be the certificate that will be challenged. The property is useful if a service has + multiple custom hostname enabled and it needs to decide on the default ssl certificate. The + setting only applied to Proxy Hostname Type. + :paramtype default_ssl_binding: bool + :keyword negotiate_client_certificate: Specify true to always negotiate client certificate on + the hostname. Default Value is false. + :paramtype negotiate_client_certificate: bool + :keyword certificate: Certificate information. + :paramtype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :keyword certificate_source: Certificate Source. Possible values include: "Managed", + "KeyVault", "Custom", "BuiltIn". + :paramtype certificate_source: str or ~azure.mgmt.apimanagement.models.CertificateSource + :keyword certificate_status: Certificate Status. Possible values include: "Completed", + "Failed", "InProgress". + :paramtype certificate_status: str or ~azure.mgmt.apimanagement.models.CertificateStatus + """ super(HostnameConfiguration, self).__init__(**kwargs) self.type = kwargs['type'] self.host_name = kwargs['host_name'] @@ -6137,17 +9087,55 @@ def __init__( self.default_ssl_binding = kwargs.get('default_ssl_binding', False) self.negotiate_client_certificate = kwargs.get('negotiate_client_certificate', False) self.certificate = kwargs.get('certificate', None) + self.certificate_source = kwargs.get('certificate_source', None) + self.certificate_status = kwargs.get('certificate_status', None) + + +class HTTPHeader(msrest.serialization.Model): + """HTTP header and it's value. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Header name. + :vartype name: str + :ivar value: Required. Header value. + :vartype value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Required. Header name. + :paramtype name: str + :keyword value: Required. Header value. + :paramtype value: str + """ + super(HTTPHeader, self).__init__(**kwargs) + self.name = kwargs['name'] + self.value = kwargs['value'] class HttpMessageDiagnostic(msrest.serialization.Model): """Http message diagnostic settings. - :param headers: Array of HTTP Headers to log. - :type headers: list[str] - :param body: Body logging settings. - :type body: ~azure.mgmt.apimanagement.models.BodyDiagnosticSettings - :param data_masking: Data masking settings. - :type data_masking: ~azure.mgmt.apimanagement.models.DataMasking + :ivar headers: Array of HTTP Headers to log. + :vartype headers: list[str] + :ivar body: Body logging settings. + :vartype body: ~azure.mgmt.apimanagement.models.BodyDiagnosticSettings + :ivar data_masking: Data masking settings. + :vartype data_masking: ~azure.mgmt.apimanagement.models.DataMasking """ _attribute_map = { @@ -6160,6 +9148,14 @@ def __init__( self, **kwargs ): + """ + :keyword headers: Array of HTTP Headers to log. + :paramtype headers: list[str] + :keyword body: Body logging settings. + :paramtype body: ~azure.mgmt.apimanagement.models.BodyDiagnosticSettings + :keyword data_masking: Data masking settings. + :paramtype data_masking: ~azure.mgmt.apimanagement.models.DataMasking + """ super(HttpMessageDiagnostic, self).__init__(**kwargs) self.headers = kwargs.get('headers', None) self.body = kwargs.get('body', None) @@ -6169,25 +9165,25 @@ def __init__( class IdentityProviderBaseParameters(msrest.serialization.Model): """Identity Provider Base Parameter Properties. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str + :vartype password_reset_policy_name: str """ _validation = { @@ -6213,6 +9209,29 @@ def __init__( self, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + """ super(IdentityProviderBaseParameters, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.signin_tenant = kwargs.get('signin_tenant', None) @@ -6229,39 +9248,41 @@ class IdentityProviderContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param type_properties_type: Identity Provider Type identifier. Possible values include: + :ivar type_properties_type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -6297,6 +9318,37 @@ def __init__( self, **kwargs ): + """ + :keyword type_properties_type: Identity Provider Type identifier. Possible values include: + "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderContract, self).__init__(**kwargs) self.type_properties_type = kwargs.get('type_properties_type', None) self.signin_tenant = kwargs.get('signin_tenant', None) @@ -6315,33 +9367,33 @@ class IdentityProviderContractProperties(IdentityProviderBaseParameters): All required parameters must be populated in order to send to Azure. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Required. Client Id of the Application in the external Identity Provider. It + :vartype password_reset_policy_name: str + :ivar client_id: Required. Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -6371,6 +9423,37 @@ def __init__( self, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Required. Client Id of the Application in the external Identity Provider. + It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderContractProperties, self).__init__(**kwargs) self.client_id = kwargs['client_id'] self.client_secret = kwargs.get('client_secret', None) @@ -6381,39 +9464,41 @@ class IdentityProviderCreateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param type_properties_type: Identity Provider Type identifier. Possible values include: + :ivar type_properties_type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -6449,6 +9534,37 @@ def __init__( self, **kwargs ): + """ + :keyword type_properties_type: Identity Provider Type identifier. Possible values include: + "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderCreateContract, self).__init__(**kwargs) self.type_properties_type = kwargs.get('type_properties_type', None) self.signin_tenant = kwargs.get('signin_tenant', None) @@ -6467,33 +9583,33 @@ class IdentityProviderCreateContractProperties(IdentityProviderBaseParameters): All required parameters must be populated in order to send to Azure. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Required. Client Id of the Application in the external Identity Provider. It + :vartype password_reset_policy_name: str + :ivar client_id: Required. Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Required. Client secret of the Application in external Identity Provider, + :vartype client_id: str + :ivar client_secret: Required. Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -6523,6 +9639,37 @@ def __init__( self, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Required. Client Id of the Application in the external Identity Provider. + It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Required. Client secret of the Application in external Identity + Provider, used to authenticate login request. For example, it is App Secret for Facebook login, + API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderCreateContractProperties, self).__init__(**kwargs) self.client_id = kwargs['client_id'] self.client_secret = kwargs['client_secret'] @@ -6531,12 +9678,12 @@ def __init__( class IdentityProviderList(msrest.serialization.Model): """List of all the Identity Providers configured on the service instance. - :param value: Identity Provider configuration values. - :type value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Identity Provider configuration values. + :vartype value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -6549,6 +9696,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Identity Provider configuration values. + :paramtype value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(IdentityProviderList, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -6558,32 +9713,32 @@ def __init__( class IdentityProviderUpdateParameters(msrest.serialization.Model): """Parameters supplied to update Identity Provider. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -6613,6 +9768,36 @@ def __init__( self, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. + :paramtype client_secret: str + """ super(IdentityProviderUpdateParameters, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.signin_tenant = kwargs.get('signin_tenant', None) @@ -6629,32 +9814,32 @@ def __init__( class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): """Parameters supplied to the Update Identity Provider operation. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -6684,6 +9869,36 @@ def __init__( self, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. + :paramtype client_secret: str + """ super(IdentityProviderUpdateProperties, self).__init__(**kwargs) self.client_id = kwargs.get('client_id', None) self.client_secret = kwargs.get('client_secret', None) @@ -6696,8 +9911,8 @@ class IssueAttachmentCollection(msrest.serialization.Model): :ivar value: Issue Attachment values. :vartype value: list[~azure.mgmt.apimanagement.models.IssueAttachmentContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -6717,6 +9932,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(IssueAttachmentCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -6728,19 +9947,21 @@ class IssueAttachmentContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param title: Filename by which the binary data will be saved. - :type title: str - :param content_format: Either 'link' if content is provided via an HTTP link or the MIME type - of the Base64-encoded binary data provided in the 'content' property. - :type content_format: str - :param content: An HTTP link or Base64-encoded binary data. - :type content: str + :ivar title: Filename by which the binary data will be saved. + :vartype title: str + :ivar content_format: Either 'link' if content is provided via an HTTP link or the MIME type of + the Base64-encoded binary data provided in the 'content' property. + :vartype content_format: str + :ivar content: An HTTP link or Base64-encoded binary data. + :vartype content: str """ _validation = { @@ -6762,6 +9983,15 @@ def __init__( self, **kwargs ): + """ + :keyword title: Filename by which the binary data will be saved. + :paramtype title: str + :keyword content_format: Either 'link' if content is provided via an HTTP link or the MIME type + of the Base64-encoded binary data provided in the 'content' property. + :paramtype content_format: str + :keyword content: An HTTP link or Base64-encoded binary data. + :paramtype content: str + """ super(IssueAttachmentContract, self).__init__(**kwargs) self.title = kwargs.get('title', None) self.content_format = kwargs.get('content_format', None) @@ -6775,8 +10005,8 @@ class IssueCollection(msrest.serialization.Model): :ivar value: Issue values. :vartype value: list[~azure.mgmt.apimanagement.models.IssueContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -6796,6 +10026,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(IssueCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -6809,8 +10043,8 @@ class IssueCommentCollection(msrest.serialization.Model): :ivar value: Issue Comment values. :vartype value: list[~azure.mgmt.apimanagement.models.IssueCommentContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -6830,6 +10064,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(IssueCommentCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -6841,18 +10079,20 @@ class IssueCommentContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param text: Comment text. - :type text: str - :param created_date: Date and time when the comment was created. - :type created_date: ~datetime.datetime - :param user_id: A resource identifier for the user who left the comment. - :type user_id: str + :ivar text: Comment text. + :vartype text: str + :ivar created_date: Date and time when the comment was created. + :vartype created_date: ~datetime.datetime + :ivar user_id: A resource identifier for the user who left the comment. + :vartype user_id: str """ _validation = { @@ -6874,6 +10114,14 @@ def __init__( self, **kwargs ): + """ + :keyword text: Comment text. + :paramtype text: str + :keyword created_date: Date and time when the comment was created. + :paramtype created_date: ~datetime.datetime + :keyword user_id: A resource identifier for the user who left the comment. + :paramtype user_id: str + """ super(IssueCommentContract, self).__init__(**kwargs) self.text = kwargs.get('text', None) self.created_date = kwargs.get('created_date', None) @@ -6885,25 +10133,27 @@ class IssueContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: The issue title. - :type title: str - :param description: Text describing the issue. - :type description: str - :param user_id: A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: The issue title. + :vartype title: str + :ivar description: Text describing the issue. + :vartype description: str + :ivar user_id: A resource identifier for the user created the issue. + :vartype user_id: str """ _validation = { @@ -6928,6 +10178,21 @@ def __init__( self, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: The issue title. + :paramtype title: str + :keyword description: Text describing the issue. + :paramtype description: str + :keyword user_id: A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueContract, self).__init__(**kwargs) self.created_date = kwargs.get('created_date', None) self.state = kwargs.get('state', None) @@ -6940,13 +10205,13 @@ def __init__( class IssueContractBaseProperties(msrest.serialization.Model): """Issue contract Base Properties. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str """ _attribute_map = { @@ -6959,6 +10224,15 @@ def __init__( self, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + """ super(IssueContractBaseProperties, self).__init__(**kwargs) self.created_date = kwargs.get('created_date', None) self.state = kwargs.get('state', None) @@ -6970,19 +10244,19 @@ class IssueContractProperties(IssueContractBaseProperties): All required parameters must be populated in order to send to Azure. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: Required. The issue title. - :type title: str - :param description: Required. Text describing the issue. - :type description: str - :param user_id: Required. A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: Required. The issue title. + :vartype title: str + :ivar description: Required. Text describing the issue. + :vartype description: str + :ivar user_id: Required. A resource identifier for the user created the issue. + :vartype user_id: str """ _validation = { @@ -7004,6 +10278,21 @@ def __init__( self, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: Required. The issue title. + :paramtype title: str + :keyword description: Required. Text describing the issue. + :paramtype description: str + :keyword user_id: Required. A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueContractProperties, self).__init__(**kwargs) self.title = kwargs['title'] self.description = kwargs['description'] @@ -7013,19 +10302,19 @@ def __init__( class IssueUpdateContract(msrest.serialization.Model): """Issue update Parameters. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: The issue title. - :type title: str - :param description: Text describing the issue. - :type description: str - :param user_id: A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: The issue title. + :vartype title: str + :ivar description: Text describing the issue. + :vartype description: str + :ivar user_id: A resource identifier for the user created the issue. + :vartype user_id: str """ _attribute_map = { @@ -7041,6 +10330,21 @@ def __init__( self, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: The issue title. + :paramtype title: str + :keyword description: Text describing the issue. + :paramtype description: str + :keyword user_id: A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueUpdateContract, self).__init__(**kwargs) self.created_date = kwargs.get('created_date', None) self.state = kwargs.get('state', None) @@ -7053,19 +10357,19 @@ def __init__( class IssueUpdateContractProperties(IssueContractBaseProperties): """Issue contract Update Properties. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: The issue title. - :type title: str - :param description: Text describing the issue. - :type description: str - :param user_id: A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: The issue title. + :vartype title: str + :ivar description: Text describing the issue. + :vartype description: str + :ivar user_id: A resource identifier for the user created the issue. + :vartype user_id: str """ _attribute_map = { @@ -7081,6 +10385,21 @@ def __init__( self, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: The issue title. + :paramtype title: str + :keyword description: Text describing the issue. + :paramtype description: str + :keyword user_id: A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueUpdateContractProperties, self).__init__(**kwargs) self.title = kwargs.get('title', None) self.description = kwargs.get('description', None) @@ -7090,13 +10409,13 @@ def __init__( class KeyVaultContractCreateProperties(msrest.serialization.Model): """Create keyVault contract details. - :param secret_identifier: Key vault secret identifier for fetching secret. Providing a - versioned secret will prevent auto-refresh. This requires Api Management service to be - configured with aka.ms/apimmsi. - :type secret_identifier: str - :param identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will + :ivar secret_identifier: Key vault secret identifier for fetching secret. Providing a versioned + secret will prevent auto-refresh. This requires API Management service to be configured with + aka.ms/apimmsi. + :vartype secret_identifier: str + :ivar identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret. - :type identity_client_id: str + :vartype identity_client_id: str """ _attribute_map = { @@ -7108,6 +10427,15 @@ def __init__( self, **kwargs ): + """ + :keyword secret_identifier: Key vault secret identifier for fetching secret. Providing a + versioned secret will prevent auto-refresh. This requires API Management service to be + configured with aka.ms/apimmsi. + :paramtype secret_identifier: str + :keyword identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which + will be used to access key vault secret. + :paramtype identity_client_id: str + """ super(KeyVaultContractCreateProperties, self).__init__(**kwargs) self.secret_identifier = kwargs.get('secret_identifier', None) self.identity_client_id = kwargs.get('identity_client_id', None) @@ -7116,15 +10444,16 @@ def __init__( class KeyVaultContractProperties(KeyVaultContractCreateProperties): """KeyVault contract details. - :param secret_identifier: Key vault secret identifier for fetching secret. Providing a - versioned secret will prevent auto-refresh. This requires Api Management service to be - configured with aka.ms/apimmsi. - :type secret_identifier: str - :param identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will + :ivar secret_identifier: Key vault secret identifier for fetching secret. Providing a versioned + secret will prevent auto-refresh. This requires API Management service to be configured with + aka.ms/apimmsi. + :vartype secret_identifier: str + :ivar identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret. - :type identity_client_id: str - :param last_status: Last time sync and refresh status of secret from key vault. - :type last_status: ~azure.mgmt.apimanagement.models.KeyVaultLastAccessStatusContractProperties + :vartype identity_client_id: str + :ivar last_status: Last time sync and refresh status of secret from key vault. + :vartype last_status: + ~azure.mgmt.apimanagement.models.KeyVaultLastAccessStatusContractProperties """ _attribute_map = { @@ -7137,6 +10466,18 @@ def __init__( self, **kwargs ): + """ + :keyword secret_identifier: Key vault secret identifier for fetching secret. Providing a + versioned secret will prevent auto-refresh. This requires API Management service to be + configured with aka.ms/apimmsi. + :paramtype secret_identifier: str + :keyword identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which + will be used to access key vault secret. + :paramtype identity_client_id: str + :keyword last_status: Last time sync and refresh status of secret from key vault. + :paramtype last_status: + ~azure.mgmt.apimanagement.models.KeyVaultLastAccessStatusContractProperties + """ super(KeyVaultContractProperties, self).__init__(**kwargs) self.last_status = kwargs.get('last_status', None) @@ -7144,13 +10485,13 @@ def __init__( class KeyVaultLastAccessStatusContractProperties(msrest.serialization.Model): """Issue contract Update Properties. - :param code: Last status code for sync and refresh of secret from key vault. - :type code: str - :param message: Details of the error else empty. - :type message: str - :param time_stamp_utc: Last time secret was accessed. The date conforms to the following - format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type time_stamp_utc: ~datetime.datetime + :ivar code: Last status code for sync and refresh of secret from key vault. + :vartype code: str + :ivar message: Details of the error else empty. + :vartype message: str + :ivar time_stamp_utc: Last time secret was accessed. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype time_stamp_utc: ~datetime.datetime """ _attribute_map = { @@ -7163,6 +10504,15 @@ def __init__( self, **kwargs ): + """ + :keyword code: Last status code for sync and refresh of secret from key vault. + :paramtype code: str + :keyword message: Details of the error else empty. + :paramtype message: str + :keyword time_stamp_utc: Last time secret was accessed. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype time_stamp_utc: ~datetime.datetime + """ super(KeyVaultLastAccessStatusContractProperties, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -7172,12 +10522,12 @@ def __init__( class LoggerCollection(msrest.serialization.Model): """Paged Logger list representation. - :param value: Logger values. - :type value: list[~azure.mgmt.apimanagement.models.LoggerContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Logger values. + :vartype value: list[~azure.mgmt.apimanagement.models.LoggerContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -7190,6 +10540,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Logger values. + :paramtype value: list[~azure.mgmt.apimanagement.models.LoggerContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(LoggerCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -7201,27 +10559,29 @@ class LoggerContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param logger_type: Logger type. Possible values include: "azureEventHub", + :ivar logger_type: Logger type. Possible values include: "azureEventHub", "applicationInsights", "azureMonitor". - :type logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType - :param description: Logger description. - :type description: str - :param credentials: The name and SendRule connection string of the event hub for azureEventHub + :vartype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :ivar description: Logger description. + :vartype description: str + :ivar credentials: The name and SendRule connection string of the event hub for azureEventHub logger. Instrumentation key for applicationInsights logger. - :type credentials: dict[str, str] - :param is_buffered: Whether records are buffered in the logger before publishing. Default is + :vartype credentials: dict[str, str] + :ivar is_buffered: Whether records are buffered in the logger before publishing. Default is assumed to be true. - :type is_buffered: bool - :param resource_id: Azure Resource Id of a log target (either Azure Event Hub resource or Azure + :vartype is_buffered: bool + :ivar resource_id: Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). - :type resource_id: str + :vartype resource_id: str """ _validation = { @@ -7246,6 +10606,23 @@ def __init__( self, **kwargs ): + """ + :keyword logger_type: Logger type. Possible values include: "azureEventHub", + "applicationInsights", "azureMonitor". + :paramtype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :keyword description: Logger description. + :paramtype description: str + :keyword credentials: The name and SendRule connection string of the event hub for + azureEventHub logger. + Instrumentation key for applicationInsights logger. + :paramtype credentials: dict[str, str] + :keyword is_buffered: Whether records are buffered in the logger before publishing. Default is + assumed to be true. + :paramtype is_buffered: bool + :keyword resource_id: Azure Resource Id of a log target (either Azure Event Hub resource or + Azure Application Insights resource). + :paramtype resource_id: str + """ super(LoggerContract, self).__init__(**kwargs) self.logger_type = kwargs.get('logger_type', None) self.description = kwargs.get('description', None) @@ -7257,16 +10634,16 @@ def __init__( class LoggerUpdateContract(msrest.serialization.Model): """Logger update contract. - :param logger_type: Logger type. Possible values include: "azureEventHub", + :ivar logger_type: Logger type. Possible values include: "azureEventHub", "applicationInsights", "azureMonitor". - :type logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType - :param description: Logger description. - :type description: str - :param credentials: Logger credentials. - :type credentials: dict[str, str] - :param is_buffered: Whether records are buffered in the logger before publishing. Default is + :vartype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :ivar description: Logger description. + :vartype description: str + :ivar credentials: Logger credentials. + :vartype credentials: dict[str, str] + :ivar is_buffered: Whether records are buffered in the logger before publishing. Default is assumed to be true. - :type is_buffered: bool + :vartype is_buffered: bool """ _attribute_map = { @@ -7280,6 +10657,18 @@ def __init__( self, **kwargs ): + """ + :keyword logger_type: Logger type. Possible values include: "azureEventHub", + "applicationInsights", "azureMonitor". + :paramtype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :keyword description: Logger description. + :paramtype description: str + :keyword credentials: Logger credentials. + :paramtype credentials: dict[str, str] + :keyword is_buffered: Whether records are buffered in the logger before publishing. Default is + assumed to be true. + :paramtype is_buffered: bool + """ super(LoggerUpdateContract, self).__init__(**kwargs) self.logger_type = kwargs.get('logger_type', None) self.description = kwargs.get('description', None) @@ -7290,12 +10679,12 @@ def __init__( class NamedValueCollection(msrest.serialization.Model): """Paged NamedValue list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.NamedValueContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.NamedValueContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -7308,6 +10697,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.NamedValueContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(NamedValueCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -7319,27 +10716,29 @@ class NamedValueContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties """ _validation = { @@ -7366,6 +10765,23 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + """ super(NamedValueContract, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.secret = kwargs.get('secret', None) @@ -7377,12 +10793,12 @@ def __init__( class NamedValueEntityBaseParameters(msrest.serialization.Model): """NamedValue Entity Base Parameters set. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool + :vartype secret: bool """ _validation = { @@ -7398,6 +10814,14 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + """ super(NamedValueEntityBaseParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.secret = kwargs.get('secret', None) @@ -7408,21 +10832,21 @@ class NamedValueContractProperties(NamedValueEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Required. Unique name of NamedValue. It may contain only letters, digits, + :vartype secret: bool + :ivar display_name: Required. Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties """ _validation = { @@ -7443,6 +10867,23 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Required. Unique name of NamedValue. It may contain only letters, + digits, period, dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + """ super(NamedValueContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] self.value = kwargs.get('value', None) @@ -7454,27 +10895,29 @@ class NamedValueCreateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -7501,6 +10944,23 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueCreateContract, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.secret = kwargs.get('secret', None) @@ -7514,21 +10974,21 @@ class NamedValueCreateContractProperties(NamedValueEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Required. Unique name of NamedValue. It may contain only letters, digits, + :vartype secret: bool + :ivar display_name: Required. Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -7549,6 +11009,23 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Required. Unique name of NamedValue. It may contain only letters, + digits, period, dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueCreateContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] self.value = kwargs.get('value', None) @@ -7558,8 +11035,8 @@ def __init__( class NamedValueSecretContract(msrest.serialization.Model): """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - :param value: This is secret value of the NamedValue entity. - :type value: str + :ivar value: This is secret value of the NamedValue entity. + :vartype value: str """ _attribute_map = { @@ -7570,6 +11047,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: This is secret value of the NamedValue entity. + :paramtype value: str + """ super(NamedValueSecretContract, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -7577,20 +11058,20 @@ def __init__( class NamedValueUpdateParameterProperties(NamedValueEntityBaseParameters): """NamedValue Contract properties. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -7611,6 +11092,22 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueUpdateParameterProperties, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.value = kwargs.get('value', None) @@ -7620,20 +11117,20 @@ def __init__( class NamedValueUpdateParameters(msrest.serialization.Model): """NamedValue update Parameters. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -7654,6 +11151,22 @@ def __init__( self, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueUpdateParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.secret = kwargs.get('secret', None) @@ -7667,11 +11180,11 @@ class NetworkStatusContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param dns_servers: Required. Gets the list of DNS servers IPV4 addresses. - :type dns_servers: list[str] - :param connectivity_status: Required. Gets the list of Connectivity Status to the Resources on + :ivar dns_servers: Required. Gets the list of DNS servers IPV4 addresses. + :vartype dns_servers: list[str] + :ivar connectivity_status: Required. Gets the list of Connectivity Status to the Resources on which the service depends upon. - :type connectivity_status: list[~azure.mgmt.apimanagement.models.ConnectivityStatusContract] + :vartype connectivity_status: list[~azure.mgmt.apimanagement.models.ConnectivityStatusContract] """ _validation = { @@ -7688,6 +11201,14 @@ def __init__( self, **kwargs ): + """ + :keyword dns_servers: Required. Gets the list of DNS servers IPV4 addresses. + :paramtype dns_servers: list[str] + :keyword connectivity_status: Required. Gets the list of Connectivity Status to the Resources + on which the service depends upon. + :paramtype connectivity_status: + list[~azure.mgmt.apimanagement.models.ConnectivityStatusContract] + """ super(NetworkStatusContract, self).__init__(**kwargs) self.dns_servers = kwargs['dns_servers'] self.connectivity_status = kwargs['connectivity_status'] @@ -7696,10 +11217,10 @@ def __init__( class NetworkStatusContractByLocation(msrest.serialization.Model): """Network Status in the Location. - :param location: Location of service. - :type location: str - :param network_status: Network status in Location. - :type network_status: ~azure.mgmt.apimanagement.models.NetworkStatusContract + :ivar location: Location of service. + :vartype location: str + :ivar network_status: Network status in Location. + :vartype network_status: ~azure.mgmt.apimanagement.models.NetworkStatusContract """ _validation = { @@ -7715,6 +11236,12 @@ def __init__( self, **kwargs ): + """ + :keyword location: Location of service. + :paramtype location: str + :keyword network_status: Network status in Location. + :paramtype network_status: ~azure.mgmt.apimanagement.models.NetworkStatusContract + """ super(NetworkStatusContractByLocation, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.network_status = kwargs.get('network_status', None) @@ -7723,12 +11250,12 @@ def __init__( class NotificationCollection(msrest.serialization.Model): """Paged Notification list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.NotificationContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.NotificationContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -7741,6 +11268,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.NotificationContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(NotificationCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -7752,18 +11287,20 @@ class NotificationContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param title: Title of the Notification. - :type title: str - :param description: Description of the Notification. - :type description: str - :param recipients: Recipient Parameter values. - :type recipients: ~azure.mgmt.apimanagement.models.RecipientsContractProperties + :ivar title: Title of the Notification. + :vartype title: str + :ivar description: Description of the Notification. + :vartype description: str + :ivar recipients: Recipient Parameter values. + :vartype recipients: ~azure.mgmt.apimanagement.models.RecipientsContractProperties """ _validation = { @@ -7786,6 +11323,14 @@ def __init__( self, **kwargs ): + """ + :keyword title: Title of the Notification. + :paramtype title: str + :keyword description: Description of the Notification. + :paramtype description: str + :keyword recipients: Recipient Parameter values. + :paramtype recipients: ~azure.mgmt.apimanagement.models.RecipientsContractProperties + """ super(NotificationContract, self).__init__(**kwargs) self.title = kwargs.get('title', None) self.description = kwargs.get('description', None) @@ -7795,10 +11340,10 @@ def __init__( class OAuth2AuthenticationSettingsContract(msrest.serialization.Model): """API OAuth2 Authentication settings details. - :param authorization_server_id: OAuth authorization server identifier. - :type authorization_server_id: str - :param scope: operations scope. - :type scope: str + :ivar authorization_server_id: OAuth authorization server identifier. + :vartype authorization_server_id: str + :ivar scope: operations scope. + :vartype scope: str """ _attribute_map = { @@ -7810,6 +11355,12 @@ def __init__( self, **kwargs ): + """ + :keyword authorization_server_id: OAuth authorization server identifier. + :paramtype authorization_server_id: str + :keyword scope: operations scope. + :paramtype scope: str + """ super(OAuth2AuthenticationSettingsContract, self).__init__(**kwargs) self.authorization_server_id = kwargs.get('authorization_server_id', None) self.scope = kwargs.get('scope', None) @@ -7818,10 +11369,10 @@ def __init__( class OpenIdAuthenticationSettingsContract(msrest.serialization.Model): """API OAuth2 Authentication settings details. - :param openid_provider_id: OAuth authorization server identifier. - :type openid_provider_id: str - :param bearer_token_sending_methods: How to send token to the server. - :type bearer_token_sending_methods: list[str or + :ivar openid_provider_id: OAuth authorization server identifier. + :vartype openid_provider_id: str + :ivar bearer_token_sending_methods: How to send token to the server. + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethods] """ @@ -7834,6 +11385,13 @@ def __init__( self, **kwargs ): + """ + :keyword openid_provider_id: OAuth authorization server identifier. + :paramtype openid_provider_id: str + :keyword bearer_token_sending_methods: How to send token to the server. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethods] + """ super(OpenIdAuthenticationSettingsContract, self).__init__(**kwargs) self.openid_provider_id = kwargs.get('openid_provider_id', None) self.bearer_token_sending_methods = kwargs.get('bearer_token_sending_methods', None) @@ -7842,12 +11400,12 @@ def __init__( class OpenIdConnectProviderCollection(msrest.serialization.Model): """Paged OpenIdProviders list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -7860,6 +11418,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(OpenIdConnectProviderCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -7871,22 +11437,24 @@ class OpenidConnectProviderContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param display_name: User-friendly OpenID Connect Provider name. - :type display_name: str - :param description: User-friendly description of OpenID Connect Provider. - :type description: str - :param metadata_endpoint: Metadata endpoint URI. - :type metadata_endpoint: str - :param client_id: Client ID of developer console which is the client application. - :type client_id: str - :param client_secret: Client Secret of developer console which is the client application. - :type client_secret: str + :ivar display_name: User-friendly OpenID Connect Provider name. + :vartype display_name: str + :ivar description: User-friendly description of OpenID Connect Provider. + :vartype description: str + :ivar metadata_endpoint: Metadata endpoint URI. + :vartype metadata_endpoint: str + :ivar client_id: Client ID of developer console which is the client application. + :vartype client_id: str + :ivar client_secret: Client Secret of developer console which is the client application. + :vartype client_secret: str """ _validation = { @@ -7911,6 +11479,18 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: User-friendly OpenID Connect Provider name. + :paramtype display_name: str + :keyword description: User-friendly description of OpenID Connect Provider. + :paramtype description: str + :keyword metadata_endpoint: Metadata endpoint URI. + :paramtype metadata_endpoint: str + :keyword client_id: Client ID of developer console which is the client application. + :paramtype client_id: str + :keyword client_secret: Client Secret of developer console which is the client application. + :paramtype client_secret: str + """ super(OpenidConnectProviderContract, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -7922,16 +11502,16 @@ def __init__( class OpenidConnectProviderUpdateContract(msrest.serialization.Model): """Parameters supplied to the Update OpenID Connect Provider operation. - :param display_name: User-friendly OpenID Connect Provider name. - :type display_name: str - :param description: User-friendly description of OpenID Connect Provider. - :type description: str - :param metadata_endpoint: Metadata endpoint URI. - :type metadata_endpoint: str - :param client_id: Client ID of developer console which is the client application. - :type client_id: str - :param client_secret: Client Secret of developer console which is the client application. - :type client_secret: str + :ivar display_name: User-friendly OpenID Connect Provider name. + :vartype display_name: str + :ivar description: User-friendly description of OpenID Connect Provider. + :vartype description: str + :ivar metadata_endpoint: Metadata endpoint URI. + :vartype metadata_endpoint: str + :ivar client_id: Client ID of developer console which is the client application. + :vartype client_id: str + :ivar client_secret: Client Secret of developer console which is the client application. + :vartype client_secret: str """ _validation = { @@ -7950,6 +11530,18 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: User-friendly OpenID Connect Provider name. + :paramtype display_name: str + :keyword description: User-friendly description of OpenID Connect Provider. + :paramtype description: str + :keyword metadata_endpoint: Metadata endpoint URI. + :paramtype metadata_endpoint: str + :keyword client_id: Client ID of developer console which is the client application. + :paramtype client_id: str + :keyword client_secret: Client Secret of developer console which is the client application. + :paramtype client_secret: str + """ super(OpenidConnectProviderUpdateContract, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.description = kwargs.get('description', None) @@ -7961,14 +11553,14 @@ def __init__( class Operation(msrest.serialization.Model): """REST API operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~azure.mgmt.apimanagement.models.OperationDisplay - :param origin: The operation origin. - :type origin: str - :param properties: The operation properties. - :type properties: any + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.apimanagement.models.OperationDisplay + :ivar origin: The operation origin. + :vartype origin: str + :ivar properties: The operation properties. + :vartype properties: any """ _attribute_map = { @@ -7982,6 +11574,16 @@ def __init__( self, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operation. + :paramtype display: ~azure.mgmt.apimanagement.models.OperationDisplay + :keyword origin: The operation origin. + :paramtype origin: str + :keyword properties: The operation properties. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -7996,8 +11598,8 @@ class OperationCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.OperationContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -8017,6 +11619,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(OperationCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -8024,34 +11630,36 @@ def __init__( class OperationContract(Resource): - """Api Operation details. + """API Operation details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Operation Name. - :type display_name: str - :param method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Operation Name. + :vartype display_name: str + :ivar method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - :type method: str - :param url_template: Relative URL template identifying the target resource for this operation. + :vartype method: str + :ivar url_template: Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -8081,6 +11689,26 @@ def __init__( self, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Operation Name. + :paramtype display_name: str + :keyword method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but + not limited by only them. + :paramtype method: str + :keyword url_template: Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationContract, self).__init__(**kwargs) self.template_parameters = kwargs.get('template_parameters', None) self.description = kwargs.get('description', None) @@ -8093,18 +11721,18 @@ def __init__( class OperationEntityBaseContract(msrest.serialization.Model): - """Api Operation Entity Base Contract details. + """API Operation Entity Base Contract details. - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str """ _validation = { @@ -8123,6 +11751,18 @@ def __init__( self, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + """ super(OperationEntityBaseContract, self).__init__(**kwargs) self.template_parameters = kwargs.get('template_parameters', None) self.description = kwargs.get('description', None) @@ -8136,24 +11776,24 @@ class OperationContractProperties(OperationEntityBaseContract): All required parameters must be populated in order to send to Azure. - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Required. Operation Name. - :type display_name: str - :param method: Required. A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, - POST but not limited by only them. - :type method: str - :param url_template: Required. Relative URL template identifying the target resource for this + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Required. Operation Name. + :vartype display_name: str + :ivar method: Required. A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST + but not limited by only them. + :vartype method: str + :ivar url_template: Required. Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -8178,6 +11818,26 @@ def __init__( self, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Required. Operation Name. + :paramtype display_name: str + :keyword method: Required. A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, + POST but not limited by only them. + :paramtype method: str + :keyword url_template: Required. Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] self.method = kwargs['method'] @@ -8187,14 +11847,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: Operation type: read, write, delete, listKeys/action, etc. - :type operation: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param description: Friendly name of the operation. - :type description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar operation: Operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar description: Friendly name of the operation. + :vartype description: str """ _attribute_map = { @@ -8208,6 +11868,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword operation: Operation type: read, write, delete, listKeys/action, etc. + :paramtype operation: str + :keyword resource: Resource type on which the operation is performed. + :paramtype resource: str + :keyword description: Friendly name of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.operation = kwargs.get('operation', None) @@ -8218,10 +11888,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.apimanagement.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.apimanagement.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -8233,6 +11903,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.apimanagement.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -8243,27 +11919,29 @@ class OperationResultContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param id_properties_id: Operation result identifier. - :type id_properties_id: str - :param status: Status of an async operation. Possible values include: "Started", "InProgress", + :ivar id_properties_id: Operation result identifier. + :vartype id_properties_id: str + :ivar status: Status of an async operation. Possible values include: "Started", "InProgress", "Succeeded", "Failed". - :type status: str or ~azure.mgmt.apimanagement.models.AsyncOperationStatus - :param started: Start time of an async operation. The date conforms to the following format: + :vartype status: str or ~azure.mgmt.apimanagement.models.AsyncOperationStatus + :ivar started: Start time of an async operation. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type started: ~datetime.datetime - :param updated: Last update time of an async operation. The date conforms to the following + :vartype started: ~datetime.datetime + :ivar updated: Last update time of an async operation. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type updated: ~datetime.datetime - :param result_info: Optional result info. - :type result_info: str - :param error: Error Body Contract. - :type error: ~azure.mgmt.apimanagement.models.ErrorResponseBody + :vartype updated: ~datetime.datetime + :ivar result_info: Optional result info. + :vartype result_info: str + :ivar error: Error Body Contract. + :vartype error: ~azure.mgmt.apimanagement.models.ErrorResponseBody :ivar action_log: This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. @@ -8294,6 +11972,23 @@ def __init__( self, **kwargs ): + """ + :keyword id_properties_id: Operation result identifier. + :paramtype id_properties_id: str + :keyword status: Status of an async operation. Possible values include: "Started", + "InProgress", "Succeeded", "Failed". + :paramtype status: str or ~azure.mgmt.apimanagement.models.AsyncOperationStatus + :keyword started: Start time of an async operation. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype started: ~datetime.datetime + :keyword updated: Last update time of an async operation. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype updated: ~datetime.datetime + :keyword result_info: Optional result info. + :paramtype result_info: str + :keyword error: Error Body Contract. + :paramtype error: ~azure.mgmt.apimanagement.models.ErrorResponseBody + """ super(OperationResultContract, self).__init__(**kwargs) self.id_properties_id = kwargs.get('id_properties_id', None) self.status = kwargs.get('status', None) @@ -8307,12 +12002,12 @@ def __init__( class OperationResultLogItemContract(msrest.serialization.Model): """Log of the entity being created, updated or deleted. - :param object_type: The type of entity contract. - :type object_type: str - :param action: Action like create/update/delete. - :type action: str - :param object_key: Identifier of the entity being created/updated/deleted. - :type object_key: str + :ivar object_type: The type of entity contract. + :vartype object_type: str + :ivar action: Action like create/update/delete. + :vartype action: str + :ivar object_key: Identifier of the entity being created/updated/deleted. + :vartype object_key: str """ _attribute_map = { @@ -8325,6 +12020,14 @@ def __init__( self, **kwargs ): + """ + :keyword object_type: The type of entity contract. + :paramtype object_type: str + :keyword action: Action like create/update/delete. + :paramtype action: str + :keyword object_key: Identifier of the entity being created/updated/deleted. + :paramtype object_key: str + """ super(OperationResultLogItemContract, self).__init__(**kwargs) self.object_type = kwargs.get('object_type', None) self.action = kwargs.get('action', None) @@ -8336,15 +12039,15 @@ class OperationTagResourceContractProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Identifier of the operation in form /operations/{operationId}. - :type id: str + :ivar id: Identifier of the operation in form /operations/{operationId}. + :vartype id: str :ivar name: Operation name. :vartype name: str - :ivar api_name: Api Name. + :ivar api_name: API Name. :vartype api_name: str - :ivar api_revision: Api Revision. + :ivar api_revision: API Revision. :vartype api_revision: str - :ivar api_version: Api Version. + :ivar api_version: API Version. :vartype api_version: str :ivar description: Operation Description. :vartype description: str @@ -8381,6 +12084,10 @@ def __init__( self, **kwargs ): + """ + :keyword id: Identifier of the operation in form /operations/{operationId}. + :paramtype id: str + """ super(OperationTagResourceContractProperties, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = None @@ -8393,26 +12100,26 @@ def __init__( class OperationUpdateContract(msrest.serialization.Model): - """Api Operation Update Contract details. - - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Operation Name. - :type display_name: str - :param method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not + """API Operation Update Contract details. + + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Operation Name. + :vartype display_name: str + :ivar method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - :type method: str - :param url_template: Relative URL template identifying the target resource for this operation. + :vartype method: str + :ivar url_template: Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -8436,6 +12143,26 @@ def __init__( self, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Operation Name. + :paramtype display_name: str + :keyword method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but + not limited by only them. + :paramtype method: str + :keyword url_template: Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationUpdateContract, self).__init__(**kwargs) self.template_parameters = kwargs.get('template_parameters', None) self.description = kwargs.get('description', None) @@ -8450,24 +12177,24 @@ def __init__( class OperationUpdateContractProperties(OperationEntityBaseContract): """Operation Update Contract Properties. - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Operation Name. - :type display_name: str - :param method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Operation Name. + :vartype display_name: str + :ivar method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - :type method: str - :param url_template: Relative URL template identifying the target resource for this operation. + :vartype method: str + :ivar url_template: Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -8491,34 +12218,127 @@ def __init__( self, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Operation Name. + :paramtype display_name: str + :keyword method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but + not limited by only them. + :paramtype method: str + :keyword url_template: Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationUpdateContractProperties, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.method = kwargs.get('method', None) self.url_template = kwargs.get('url_template', None) -class ParameterContract(msrest.serialization.Model): - """Operation parameters details. - - All required parameters must be populated in order to send to Azure. +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the Api Management Service requires outbound network access to. - :param name: Required. Parameter name. - :type name: str - :param description: Parameter description. - :type description: str - :param type: Required. Parameter type. - :type type: str - :param default_value: Default parameter value. - :type default_value: str - :param required: Specifies whether parameter is required or not. - :type required: bool - :param values: Parameter values. - :type values: list[str] + :ivar category: The type of service accessed by the Api Management Service, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :vartype category: str + :ivar endpoints: The endpoints that the Api Management Service reaches the service at. + :vartype endpoints: list[~azure.mgmt.apimanagement.models.EndpointDependency] """ - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword category: The type of service accessed by the Api Management Service, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :paramtype category: str + :keyword endpoints: The endpoints that the Api Management Service reaches the service at. + :paramtype endpoints: list[~azure.mgmt.apimanagement.models.EndpointDependency] + """ + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = kwargs.get('category', None) + self.endpoints = kwargs.get('endpoints', None) + + +class OutboundEnvironmentEndpointList(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + 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 value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpoint] + """ + super(OutboundEnvironmentEndpointList, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None + + +class ParameterContract(msrest.serialization.Model): + """Operation parameters details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Parameter name. + :vartype name: str + :ivar description: Parameter description. + :vartype description: str + :ivar type: Required. Parameter type. + :vartype type: str + :ivar default_value: Default parameter value. + :vartype default_value: str + :ivar required: Specifies whether parameter is required or not. + :vartype required: bool + :ivar values: Parameter values. + :vartype values: list[str] + :ivar schema_id: Schema identifier. + :vartype schema_id: str + :ivar type_name: Type name defined by the schema. + :vartype type_name: str + :ivar examples: Exampled defined for the parameter. + :vartype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, } _attribute_map = { @@ -8528,12 +12348,35 @@ class ParameterContract(msrest.serialization.Model): 'default_value': {'key': 'defaultValue', 'type': 'str'}, 'required': {'key': 'required', 'type': 'bool'}, 'values': {'key': 'values', 'type': '[str]'}, + 'schema_id': {'key': 'schemaId', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'examples': {'key': 'examples', 'type': '{ParameterExampleContract}'}, } def __init__( self, **kwargs ): + """ + :keyword name: Required. Parameter name. + :paramtype name: str + :keyword description: Parameter description. + :paramtype description: str + :keyword type: Required. Parameter type. + :paramtype type: str + :keyword default_value: Default parameter value. + :paramtype default_value: str + :keyword required: Specifies whether parameter is required or not. + :paramtype required: bool + :keyword values: Parameter values. + :paramtype values: list[str] + :keyword schema_id: Schema identifier. + :paramtype schema_id: str + :keyword type_name: Type name defined by the schema. + :paramtype type_name: str + :keyword examples: Exampled defined for the parameter. + :paramtype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + """ super(ParameterContract, self).__init__(**kwargs) self.name = kwargs['name'] self.description = kwargs.get('description', None) @@ -8541,15 +12384,59 @@ def __init__( self.default_value = kwargs.get('default_value', None) self.required = kwargs.get('required', None) self.values = kwargs.get('values', None) + self.schema_id = kwargs.get('schema_id', None) + self.type_name = kwargs.get('type_name', None) + self.examples = kwargs.get('examples', None) + + +class ParameterExampleContract(msrest.serialization.Model): + """Parameter example. + + :ivar summary: Short description for the example. + :vartype summary: str + :ivar description: Long description for the example. + :vartype description: str + :ivar value: Example value. May be a primitive value, or an object. + :vartype value: any + :ivar external_value: A URL that points to the literal example. + :vartype external_value: str + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'object'}, + 'external_value': {'key': 'externalValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword summary: Short description for the example. + :paramtype summary: str + :keyword description: Long description for the example. + :paramtype description: str + :keyword value: Example value. May be a primitive value, or an object. + :paramtype value: any + :keyword external_value: A URL that points to the literal example. + :paramtype external_value: str + """ + super(ParameterExampleContract, self).__init__(**kwargs) + self.summary = kwargs.get('summary', None) + self.description = kwargs.get('description', None) + self.value = kwargs.get('value', None) + self.external_value = kwargs.get('external_value', None) class PipelineDiagnosticSettings(msrest.serialization.Model): """Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - :param request: Diagnostic settings for request. - :type request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic - :param response: Diagnostic settings for response. - :type response: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + :ivar request: Diagnostic settings for request. + :vartype request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + :ivar response: Diagnostic settings for response. + :vartype response: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic """ _attribute_map = { @@ -8561,6 +12448,12 @@ def __init__( self, **kwargs ): + """ + :keyword request: Diagnostic settings for request. + :paramtype request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + :keyword response: Diagnostic settings for response. + :paramtype response: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + """ super(PipelineDiagnosticSettings, self).__init__(**kwargs) self.request = kwargs.get('request', None) self.response = kwargs.get('response', None) @@ -8569,12 +12462,12 @@ def __init__( class PolicyCollection(msrest.serialization.Model): """The response of the list policy operation. - :param value: Policy Contract value. - :type value: list[~azure.mgmt.apimanagement.models.PolicyContract] - :param count: Total record count number. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Policy Contract value. + :vartype value: list[~azure.mgmt.apimanagement.models.PolicyContract] + :ivar count: Total record count number. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -8587,6 +12480,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Policy Contract value. + :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyContract] + :keyword count: Total record count number. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(PolicyCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -8598,17 +12499,19 @@ class PolicyContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param value: Contents of the Policy as defined by the format. - :type value: str - :param format: Format of the policyContent. Possible values include: "xml", "xml-link", + :ivar value: Contents of the Policy as defined by the format. + :vartype value: str + :ivar format: Format of the policyContent. Possible values include: "xml", "xml-link", "rawxml", "rawxml-link". Default value: "xml". - :type format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat """ _validation = { @@ -8629,6 +12532,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Contents of the Policy as defined by the format. + :paramtype value: str + :keyword format: Format of the policyContent. Possible values include: "xml", "xml-link", + "rawxml", "rawxml-link". Default value: "xml". + :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + """ super(PolicyContract, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.format = kwargs.get('format', "xml") @@ -8637,10 +12547,10 @@ def __init__( class PolicyDescriptionCollection(msrest.serialization.Model): """Descriptions of APIM policies. - :param value: Descriptions of APIM policies. - :type value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] - :param count: Total record count number. - :type count: long + :ivar value: Descriptions of APIM policies. + :vartype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] + :ivar count: Total record count number. + :vartype count: long """ _attribute_map = { @@ -8652,6 +12562,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Descriptions of APIM policies. + :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] + :keyword count: Total record count number. + :paramtype count: long + """ super(PolicyDescriptionCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -8662,11 +12578,13 @@ class PolicyDescriptionContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar description: Policy description. :vartype description: str @@ -8694,6 +12612,8 @@ def __init__( self, **kwargs ): + """ + """ super(PolicyDescriptionContract, self).__init__(**kwargs) self.description = None self.scope = None @@ -8704,21 +12624,24 @@ class PortalDelegationSettings(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param url: A delegation Url. - :type url: str - :param validation_key: A base64-encoded validation key to validate, that a request is coming + :ivar url: A delegation Url. + :vartype url: str + :ivar validation_key: A base64-encoded validation key to validate, that a request is coming from Azure API Management. - :type validation_key: str - :param subscriptions: Subscriptions delegation settings. - :type subscriptions: ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties - :param user_registration: User registration delegation settings. - :type user_registration: + :vartype validation_key: str + :ivar subscriptions: Subscriptions delegation settings. + :vartype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :ivar user_registration: User registration delegation settings. + :vartype user_registration: ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties """ @@ -8742,6 +12665,19 @@ def __init__( self, **kwargs ): + """ + :keyword url: A delegation Url. + :paramtype url: str + :keyword validation_key: A base64-encoded validation key to validate, that a request is coming + from Azure API Management. + :paramtype validation_key: str + :keyword subscriptions: Subscriptions delegation settings. + :paramtype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :keyword user_registration: User registration delegation settings. + :paramtype user_registration: + ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties + """ super(PortalDelegationSettings, self).__init__(**kwargs) self.url = kwargs.get('url', None) self.validation_key = kwargs.get('validation_key', None) @@ -8774,32 +12710,36 @@ def __init__( self, **kwargs ): + """ + """ super(PortalRevisionCollection, self).__init__(**kwargs) self.value = None self.next_link = None class PortalRevisionContract(Resource): - """Portal revisions contract details. + """Portal Revision's contract details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Portal revision description. - :type description: str + :ivar description: Portal revision description. + :vartype description: str :ivar status_details: Portal revision publishing status details. :vartype status_details: str - :ivar status: Portal revision publishing status. Possible values include: "pending", + :ivar status: Status of the portal's revision. Possible values include: "pending", "publishing", "completed", "failed". :vartype status: str or ~azure.mgmt.apimanagement.models.PortalRevisionStatus - :param is_current: Indicates if the Portal Revision is public. - :type is_current: bool - :ivar created_date_time: Portal revision creation date and time. + :ivar is_current: Indicates if the portal's revision is public. + :vartype is_current: bool + :ivar created_date_time: Portal's revision creation date and time. :vartype created_date_time: ~datetime.datetime :ivar updated_date_time: Last updated date and time. :vartype updated_date_time: ~datetime.datetime @@ -8809,223 +12749,555 @@ class PortalRevisionContract(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'description': {'max_length': 2000, 'min_length': 0}, - 'status_details': {'readonly': True, 'max_length': 2000, 'min_length': 0}, - 'status': {'readonly': True}, - 'created_date_time': {'readonly': True}, - 'updated_date_time': {'readonly': True}, + 'description': {'max_length': 2000, 'min_length': 0}, + 'status_details': {'readonly': True, 'max_length': 2000, 'min_length': 0}, + 'status': {'readonly': True}, + 'created_date_time': {'readonly': True}, + 'updated_date_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'is_current': {'key': 'properties.isCurrent', 'type': 'bool'}, + 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, + 'updated_date_time': {'key': 'properties.updatedDateTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: Portal revision description. + :paramtype description: str + :keyword is_current: Indicates if the portal's revision is public. + :paramtype is_current: bool + """ + super(PortalRevisionContract, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.status_details = None + self.status = None + self.is_current = kwargs.get('is_current', None) + self.created_date_time = None + self.updated_date_time = None + + +class PortalSettingsCollection(msrest.serialization.Model): + """Descriptions of APIM policies. + + :ivar value: Descriptions of APIM policies. + :vartype value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] + :ivar count: Total record count number. + :vartype count: long + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PortalSettingsContract]'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Descriptions of APIM policies. + :paramtype value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] + :keyword count: Total record count number. + :paramtype count: long + """ + super(PortalSettingsCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.count = kwargs.get('count', None) + + +class PortalSettingsContract(Resource): + """Portal Settings for the Developer Portal. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar url: A delegation Url. + :vartype url: str + :ivar validation_key: A base64-encoded validation key to validate, that a request is coming + from Azure API Management. + :vartype validation_key: str + :ivar subscriptions: Subscriptions delegation settings. + :vartype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :ivar user_registration: User registration delegation settings. + :vartype user_registration: + ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties + :ivar enabled: Redirect Anonymous users to the Sign-In page. + :vartype enabled: bool + :ivar terms_of_service: Terms of service contract properties. + :vartype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + + _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'}, + 'url': {'key': 'properties.url', 'type': 'str'}, + 'validation_key': {'key': 'properties.validationKey', 'type': 'str'}, + 'subscriptions': {'key': 'properties.subscriptions', 'type': 'SubscriptionsDelegationSettingsProperties'}, + 'user_registration': {'key': 'properties.userRegistration', 'type': 'RegistrationDelegationSettingsProperties'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword url: A delegation Url. + :paramtype url: str + :keyword validation_key: A base64-encoded validation key to validate, that a request is coming + from Azure API Management. + :paramtype validation_key: str + :keyword subscriptions: Subscriptions delegation settings. + :paramtype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :keyword user_registration: User registration delegation settings. + :paramtype user_registration: + ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties + :keyword enabled: Redirect Anonymous users to the Sign-In page. + :paramtype enabled: bool + :keyword terms_of_service: Terms of service contract properties. + :paramtype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + super(PortalSettingsContract, self).__init__(**kwargs) + self.url = kwargs.get('url', None) + self.validation_key = kwargs.get('validation_key', None) + self.subscriptions = kwargs.get('subscriptions', None) + self.user_registration = kwargs.get('user_registration', None) + self.enabled = kwargs.get('enabled', None) + self.terms_of_service = kwargs.get('terms_of_service', None) + + +class PortalSettingValidationKeyContract(msrest.serialization.Model): + """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + + :ivar validation_key: This is secret value of the validation key in portal settings. + :vartype validation_key: str + """ + + _attribute_map = { + 'validation_key': {'key': 'validationKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword validation_key: This is secret value of the validation key in portal settings. + :paramtype validation_key: str + """ + super(PortalSettingValidationKeyContract, self).__init__(**kwargs) + self.validation_key = kwargs.get('validation_key', None) + + +class PortalSigninSettings(Resource): + """Sign-In settings for the Developer Portal. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar enabled: Redirect Anonymous users to the Sign-In page. + :vartype enabled: bool + """ + + _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'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword enabled: Redirect Anonymous users to the Sign-In page. + :paramtype enabled: bool + """ + super(PortalSigninSettings, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + + +class PortalSignupSettings(Resource): + """Sign-Up settings for a developer portal. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar enabled: Allow users to sign up on a developer portal. + :vartype enabled: bool + :ivar terms_of_service: Terms of service contract properties. + :vartype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + + _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'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword enabled: Allow users to sign up on a developer portal. + :paramtype enabled: bool + :keyword terms_of_service: Terms of service contract properties. + :paramtype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + super(PortalSignupSettings, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.terms_of_service = kwargs.get('terms_of_service', None) + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.apimanagement.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'is_current': {'key': 'properties.isCurrent', 'type': 'bool'}, - 'created_date_time': {'key': 'properties.createdDateTime', 'type': 'iso-8601'}, - 'updated_date_time': {'key': 'properties.updatedDateTime', 'type': 'iso-8601'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(PortalRevisionContract, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.status_details = None - self.status = None - self.is_current = kwargs.get('is_current', None) - self.created_date_time = None - self.updated_date_time = None + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None -class PortalSettingsCollection(msrest.serialization.Model): - """Descriptions of APIM policies. +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. - :param value: Descriptions of APIM policies. - :type value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] - :param count: Total record count number. - :type count: long + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PortalSettingsContract]'}, - 'count': {'key': 'count', 'type': 'long'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( self, **kwargs ): - super(PortalSettingsCollection, self).__init__(**kwargs) + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) - self.count = kwargs.get('count', None) -class PortalSettingsContract(Resource): - """Portal Settings for the Developer Portal. - - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateEndpointConnectionRequest(msrest.serialization.Model): + """A request to approve or reject a private endpoint connection. - :ivar id: Resource ID. + :ivar id: Private Endpoint Connection Resource Id. :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type for API Management resource. - :vartype type: str - :param url: A delegation Url. - :type url: str - :param validation_key: A base64-encoded validation key to validate, that a request is coming - from Azure API Management. - :type validation_key: str - :param subscriptions: Subscriptions delegation settings. - :type subscriptions: ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties - :param user_registration: User registration delegation settings. - :type user_registration: - ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties - :param enabled: Redirect Anonymous users to the Sign-In page. - :type enabled: bool - :param terms_of_service: Terms of service contract properties. - :type terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + :ivar properties: The connection state of the private endpoint connection. + :vartype properties: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties """ - _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'}, - 'url': {'key': 'properties.url', 'type': 'str'}, - 'validation_key': {'key': 'properties.validationKey', 'type': 'str'}, - 'subscriptions': {'key': 'properties.subscriptions', 'type': 'SubscriptionsDelegationSettingsProperties'}, - 'user_registration': {'key': 'properties.userRegistration', 'type': 'RegistrationDelegationSettingsProperties'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionRequestProperties'}, } def __init__( self, **kwargs ): - super(PortalSettingsContract, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.validation_key = kwargs.get('validation_key', None) - self.subscriptions = kwargs.get('subscriptions', None) - self.user_registration = kwargs.get('user_registration', None) - self.enabled = kwargs.get('enabled', None) - self.terms_of_service = kwargs.get('terms_of_service', None) + """ + :keyword id: Private Endpoint Connection Resource Id. + :paramtype id: str + :keyword properties: The connection state of the private endpoint connection. + :paramtype properties: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties + """ + super(PrivateEndpointConnectionRequest, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.properties = kwargs.get('properties', None) -class PortalSettingValidationKeyContract(msrest.serialization.Model): - """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. +class PrivateEndpointConnectionRequestProperties(msrest.serialization.Model): + """The connection state of the private endpoint connection. - :param validation_key: This is secret value of the validation key in portal settings. - :type validation_key: str + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState """ _attribute_map = { - 'validation_key': {'key': 'validationKey', 'type': 'str'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, } def __init__( self, **kwargs ): - super(PortalSettingValidationKeyContract, self).__init__(**kwargs) - self.validation_key = kwargs.get('validation_key', None) + """ + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnectionRequestProperties, self).__init__(**kwargs) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) -class PortalSigninSettings(Resource): - """Sign-In settings for the Developer Portal. +class PrivateLinkResource(Resource): + """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param enabled: Redirect Anonymous users to the Sign-In page. - :type enabled: bool + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } def __init__( self, **kwargs ): - super(PortalSigninSettings, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) -class PortalSignupSettings(Resource): - """Sign-Up settings for a developer portal. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - :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 enabled: Allow users to sign up on a developer portal. - :type enabled: bool - :param terms_of_service: Terms of service contract properties. - :type terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } + def __init__( + self, + **kwargs + ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :vartype status: str or ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( self, **kwargs ): - super(PortalSignupSettings, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.terms_of_service = kwargs.get('terms_of_service', None) + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) class ProductCollection(msrest.serialization.Model): """Paged Products list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.ProductContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ProductContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9038,6 +13310,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ProductContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(ProductCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -9049,40 +13329,42 @@ class ProductContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { @@ -9110,6 +13392,36 @@ def __init__( self, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ super(ProductContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.terms = kwargs.get('terms', None) @@ -9123,32 +13435,32 @@ def __init__( class ProductEntityBaseParameters(msrest.serialization.Model): """Product Entity Base Parameters. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState """ _validation = { @@ -9168,6 +13480,34 @@ def __init__( self, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + """ super(ProductEntityBaseParameters, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.terms = kwargs.get('terms', None) @@ -9182,34 +13522,34 @@ class ProductContractProperties(ProductEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Required. Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Required. Product name. + :vartype display_name: str """ _validation = { @@ -9231,6 +13571,36 @@ def __init__( self, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Required. Product name. + :paramtype display_name: str + """ super(ProductContractProperties, self).__init__(**kwargs) self.display_name = kwargs['display_name'] @@ -9240,36 +13610,36 @@ class ProductTagResourceContractProperties(ProductEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param id: Identifier of the product in the form of /products/{productId}. - :type id: str - :param name: Required. Product name. - :type name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar id: Identifier of the product in the form of /products/{productId}. + :vartype id: str + :ivar name: Required. Product name. + :vartype name: str """ _validation = { @@ -9292,6 +13662,38 @@ def __init__( self, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword id: Identifier of the product in the form of /products/{productId}. + :paramtype id: str + :keyword name: Required. Product name. + :paramtype name: str + """ super(ProductTagResourceContractProperties, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs['name'] @@ -9300,34 +13702,34 @@ def __init__( class ProductUpdateParameters(msrest.serialization.Model): """Product Update parameters. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { @@ -9349,6 +13751,36 @@ def __init__( self, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ super(ProductUpdateParameters, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.terms = kwargs.get('terms', None) @@ -9362,34 +13794,34 @@ def __init__( class ProductUpdateProperties(ProductEntityBaseParameters): """Parameters supplied to the Update Product operation. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { @@ -9411,6 +13843,36 @@ def __init__( self, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ super(ProductUpdateProperties, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) @@ -9418,12 +13880,12 @@ def __init__( class QuotaCounterCollection(msrest.serialization.Model): """Paged Quota Counter list representation. - :param value: Quota counter values. - :type value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Quota counter values. + :vartype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9436,6 +13898,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Quota counter values. + :paramtype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(QuotaCounterCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -9447,19 +13917,19 @@ class QuotaCounterContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counter_key: Required. The Key value of the Counter. Must not be empty. - :type counter_key: str - :param period_key: Required. Identifier of the Period for which the counter was collected. Must + :ivar counter_key: Required. The Key value of the Counter. Must not be empty. + :vartype counter_key: str + :ivar period_key: Required. Identifier of the Period for which the counter was collected. Must not be empty. - :type period_key: str - :param period_start_time: Required. The date of the start of Counter Period. The date conforms + :vartype period_key: str + :ivar period_start_time: Required. The date of the start of Counter Period. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type period_start_time: ~datetime.datetime - :param period_end_time: Required. The date of the end of Counter Period. The date conforms to + :vartype period_start_time: ~datetime.datetime + :ivar period_end_time: Required. The date of the end of Counter Period. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type period_end_time: ~datetime.datetime - :param value: Quota Value Properties. - :type value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + :vartype period_end_time: ~datetime.datetime + :ivar value: Quota Value Properties. + :vartype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties """ _validation = { @@ -9481,6 +13951,22 @@ def __init__( self, **kwargs ): + """ + :keyword counter_key: Required. The Key value of the Counter. Must not be empty. + :paramtype counter_key: str + :keyword period_key: Required. Identifier of the Period for which the counter was collected. + Must not be empty. + :paramtype period_key: str + :keyword period_start_time: Required. The date of the start of Counter Period. The date + conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype period_start_time: ~datetime.datetime + :keyword period_end_time: Required. The date of the end of Counter Period. The date conforms to + the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype period_end_time: ~datetime.datetime + :keyword value: Quota Value Properties. + :paramtype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + """ super(QuotaCounterContract, self).__init__(**kwargs) self.counter_key = kwargs['counter_key'] self.period_key = kwargs['period_key'] @@ -9492,10 +13978,10 @@ def __init__( class QuotaCounterValueContract(msrest.serialization.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 + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ _attribute_map = { @@ -9507,6 +13993,12 @@ def __init__( self, **kwargs ): + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ super(QuotaCounterValueContract, self).__init__(**kwargs) self.calls_count = kwargs.get('calls_count', None) self.kb_transferred = kwargs.get('kb_transferred', None) @@ -9515,10 +14007,10 @@ def __init__( class QuotaCounterValueContractProperties(msrest.serialization.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 + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ _attribute_map = { @@ -9530,6 +14022,12 @@ def __init__( self, **kwargs ): + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ super(QuotaCounterValueContractProperties, self).__init__(**kwargs) self.calls_count = kwargs.get('calls_count', None) self.kb_transferred = kwargs.get('kb_transferred', None) @@ -9538,10 +14036,10 @@ def __init__( class QuotaCounterValueUpdateContract(msrest.serialization.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 + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ _attribute_map = { @@ -9553,6 +14051,12 @@ def __init__( self, **kwargs ): + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ super(QuotaCounterValueUpdateContract, self).__init__(**kwargs) self.calls_count = kwargs.get('calls_count', None) self.kb_transferred = kwargs.get('kb_transferred', None) @@ -9561,12 +14065,12 @@ def __init__( class RecipientEmailCollection(msrest.serialization.Model): """Paged Recipient User list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9579,6 +14083,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(RecipientEmailCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -9590,14 +14102,16 @@ class RecipientEmailContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param email: User Email subscribed to notification. - :type email: str + :ivar email: User Email subscribed to notification. + :vartype email: str """ _validation = { @@ -9617,6 +14131,10 @@ def __init__( self, **kwargs ): + """ + :keyword email: User Email subscribed to notification. + :paramtype email: str + """ super(RecipientEmailContract, self).__init__(**kwargs) self.email = kwargs.get('email', None) @@ -9624,10 +14142,10 @@ def __init__( class RecipientsContractProperties(msrest.serialization.Model): """Notification Parameter contract. - :param emails: List of Emails subscribed for the notification. - :type emails: list[str] - :param users: List of Users subscribed for the notification. - :type users: list[str] + :ivar emails: List of Emails subscribed for the notification. + :vartype emails: list[str] + :ivar users: List of Users subscribed for the notification. + :vartype users: list[str] """ _attribute_map = { @@ -9639,6 +14157,12 @@ def __init__( self, **kwargs ): + """ + :keyword emails: List of Emails subscribed for the notification. + :paramtype emails: list[str] + :keyword users: List of Users subscribed for the notification. + :paramtype users: list[str] + """ super(RecipientsContractProperties, self).__init__(**kwargs) self.emails = kwargs.get('emails', None) self.users = kwargs.get('users', None) @@ -9647,12 +14171,12 @@ def __init__( class RecipientUserCollection(msrest.serialization.Model): """Paged Recipient User list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9665,6 +14189,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(RecipientUserCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -9676,14 +14208,16 @@ class RecipientUserContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param user_id: API Management UserId subscribed to notification. - :type user_id: str + :ivar user_id: API Management UserId subscribed to notification. + :vartype user_id: str """ _validation = { @@ -9703,6 +14237,10 @@ def __init__( self, **kwargs ): + """ + :keyword user_id: API Management UserId subscribed to notification. + :paramtype user_id: str + """ super(RecipientUserContract, self).__init__(**kwargs) self.user_id = kwargs.get('user_id', None) @@ -9714,10 +14252,10 @@ class RegionContract(msrest.serialization.Model): :ivar name: Region name. :vartype name: str - :param is_master_region: whether Region is the master region. - :type is_master_region: bool - :param is_deleted: whether Region is deleted. - :type is_deleted: bool + :ivar is_master_region: whether Region is the master region. + :vartype is_master_region: bool + :ivar is_deleted: whether Region is deleted. + :vartype is_deleted: bool """ _validation = { @@ -9734,6 +14272,12 @@ def __init__( self, **kwargs ): + """ + :keyword is_master_region: whether Region is the master region. + :paramtype is_master_region: bool + :keyword is_deleted: whether Region is deleted. + :paramtype is_deleted: bool + """ super(RegionContract, self).__init__(**kwargs) self.name = None self.is_master_region = kwargs.get('is_master_region', None) @@ -9743,12 +14287,12 @@ def __init__( class RegionListResult(msrest.serialization.Model): """Lists Regions operation response details. - :param value: Lists of Regions. - :type value: list[~azure.mgmt.apimanagement.models.RegionContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Lists of Regions. + :vartype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9761,6 +14305,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Lists of Regions. + :paramtype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(RegionListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -9770,8 +14322,8 @@ def __init__( class RegistrationDelegationSettingsProperties(msrest.serialization.Model): """User registration delegation settings properties. - :param enabled: Enable or disable delegation for user registration. - :type enabled: bool + :ivar enabled: Enable or disable delegation for user registration. + :vartype enabled: bool """ _attribute_map = { @@ -9782,19 +14334,89 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Enable or disable delegation for user registration. + :paramtype enabled: bool + """ super(RegistrationDelegationSettingsProperties, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) +class RemotePrivateEndpointConnectionWrapper(msrest.serialization.Model): + """Remote Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Private Endpoint connection resource id. + :vartype id: str + :ivar name: Private Endpoint Connection Name. + :vartype name: str + :ivar type: Private Endpoint Connection Resource Type. + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + :vartype provisioning_state: str + :ivar group_ids: All the Group ids. + :vartype group_ids: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'group_ids': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'ArmIdWrapper'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'group_ids': {'key': 'properties.groupIds', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword id: Private Endpoint connection resource id. + :paramtype id: str + :keyword name: Private Endpoint Connection Name. + :paramtype name: str + :keyword type: Private Endpoint Connection Resource Type. + :paramtype type: str + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super(RemotePrivateEndpointConnectionWrapper, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None + self.group_ids = None + + class ReportCollection(msrest.serialization.Model): """Paged Report records list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9807,6 +14429,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(ReportCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -9818,67 +14448,67 @@ class ReportRecordContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Name depending on report endpoint specifies product, API, operation or developer + :ivar name: Name depending on report endpoint specifies product, API, operation or developer name. - :type name: str - :param timestamp: Start of aggregation period. The date conforms to the following format: + :vartype name: str + :ivar timestamp: Start of aggregation period. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type timestamp: ~datetime.datetime - :param interval: Length of aggregation period. Interval must be multiple of 15 minutes and may + :vartype timestamp: ~datetime.datetime + :ivar interval: Length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). - :type interval: str - :param country: Country to which this record data is related. - :type country: str - :param region: Country region to which this record data is related. - :type region: str - :param zip: Zip code to which this record data is related. - :type zip: str + :vartype interval: str + :ivar country: Country to which this record data is related. + :vartype country: str + :ivar region: Country region to which this record data is related. + :vartype region: str + :ivar zip: Zip code to which this record data is related. + :vartype zip: str :ivar user_id: User identifier path. /users/{userId}. :vartype user_id: str :ivar product_id: Product identifier path. /products/{productId}. :vartype product_id: str - :param api_id: API identifier path. /apis/{apiId}. - :type api_id: str - :param operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :type operation_id: str - :param api_region: API region identifier. - :type api_region: str - :param subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :type subscription_id: str - :param call_count_success: Number of successful calls. This includes calls returning + :ivar api_id: API identifier path. /apis/{apiId}. + :vartype api_id: str + :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :vartype operation_id: str + :ivar api_region: API region identifier. + :vartype api_region: str + :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :vartype subscription_id: str + :ivar call_count_success: Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. - :type call_count_success: int - :param call_count_blocked: Number of calls blocked due to invalid credentials. This includes + :vartype call_count_success: int + :ivar call_count_blocked: Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. - :type call_count_blocked: int - :param call_count_failed: Number of calls failed due to proxy or backend errors. This includes + :vartype call_count_blocked: int + :ivar call_count_failed: Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. - :type call_count_failed: int - :param call_count_other: Number of other calls. - :type call_count_other: int - :param call_count_total: Total number of calls. - :type call_count_total: int - :param bandwidth: Bandwidth consumed. - :type bandwidth: long - :param cache_hit_count: Number of times when content was served from cache policy. - :type cache_hit_count: int - :param cache_miss_count: Number of times content was fetched from backend. - :type cache_miss_count: int - :param api_time_avg: Average time it took to process request. - :type api_time_avg: float - :param api_time_min: Minimum time it took to process request. - :type api_time_min: float - :param api_time_max: Maximum time it took to process request. - :type api_time_max: float - :param service_time_avg: Average time it took to process request on backend. - :type service_time_avg: float - :param service_time_min: Minimum time it took to process request on backend. - :type service_time_min: float - :param service_time_max: Maximum time it took to process request on backend. - :type service_time_max: float + :vartype call_count_failed: int + :ivar call_count_other: Number of other calls. + :vartype call_count_other: int + :ivar call_count_total: Total number of calls. + :vartype call_count_total: int + :ivar bandwidth: Bandwidth consumed. + :vartype bandwidth: long + :ivar cache_hit_count: Number of times when content was served from cache policy. + :vartype cache_hit_count: int + :ivar cache_miss_count: Number of times content was fetched from backend. + :vartype cache_miss_count: int + :ivar api_time_avg: Average time it took to process request. + :vartype api_time_avg: float + :ivar api_time_min: Minimum time it took to process request. + :vartype api_time_min: float + :ivar api_time_max: Maximum time it took to process request. + :vartype api_time_max: float + :ivar service_time_avg: Average time it took to process request on backend. + :vartype service_time_avg: float + :ivar service_time_min: Minimum time it took to process request on backend. + :vartype service_time_min: float + :ivar service_time_max: Maximum time it took to process request on backend. + :vartype service_time_max: float """ _validation = { @@ -9919,6 +14549,65 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name depending on report endpoint specifies product, API, operation or developer + name. + :paramtype name: str + :keyword timestamp: Start of aggregation period. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype timestamp: ~datetime.datetime + :keyword interval: Length of aggregation period. Interval must be multiple of 15 minutes and + may not be zero. The value should be in ISO 8601 format + (http://en.wikipedia.org/wiki/ISO_8601#Durations). + :paramtype interval: str + :keyword country: Country to which this record data is related. + :paramtype country: str + :keyword region: Country region to which this record data is related. + :paramtype region: str + :keyword zip: Zip code to which this record data is related. + :paramtype zip: str + :keyword api_id: API identifier path. /apis/{apiId}. + :paramtype api_id: str + :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :paramtype operation_id: str + :keyword api_region: API region identifier. + :paramtype api_region: str + :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :paramtype subscription_id: str + :keyword call_count_success: Number of successful calls. This includes calls returning + HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. + :paramtype call_count_success: int + :keyword call_count_blocked: Number of calls blocked due to invalid credentials. This includes + calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and + HttpStatusCode.TooManyRequests. + :paramtype call_count_blocked: int + :keyword call_count_failed: Number of calls failed due to proxy or backend errors. This + includes calls returning HttpStatusCode.BadRequest(400) and any Code between + HttpStatusCode.InternalServerError (500) and 600. + :paramtype call_count_failed: int + :keyword call_count_other: Number of other calls. + :paramtype call_count_other: int + :keyword call_count_total: Total number of calls. + :paramtype call_count_total: int + :keyword bandwidth: Bandwidth consumed. + :paramtype bandwidth: long + :keyword cache_hit_count: Number of times when content was served from cache policy. + :paramtype cache_hit_count: int + :keyword cache_miss_count: Number of times content was fetched from backend. + :paramtype cache_miss_count: int + :keyword api_time_avg: Average time it took to process request. + :paramtype api_time_avg: float + :keyword api_time_min: Minimum time it took to process request. + :paramtype api_time_min: float + :keyword api_time_max: Maximum time it took to process request. + :paramtype api_time_max: float + :keyword service_time_avg: Average time it took to process request on backend. + :paramtype service_time_avg: float + :keyword service_time_min: Minimum time it took to process request on backend. + :paramtype service_time_min: float + :keyword service_time_max: Maximum time it took to process request on backend. + :paramtype service_time_max: float + """ super(ReportRecordContract, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.timestamp = kwargs.get('timestamp', None) @@ -9953,20 +14642,20 @@ class RepresentationContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param content_type: Required. Specifies a registered or custom content type for this + :ivar content_type: Required. Specifies a registered or custom content type for this representation, e.g. application/xml. - :type content_type: str - :param sample: An example of the representation. - :type sample: str - :param schema_id: Schema identifier. Applicable only if 'contentType' value is neither + :vartype content_type: str + :ivar schema_id: Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :type schema_id: str - :param type_name: Type name defined by the schema. Applicable only if 'contentType' value is + :vartype schema_id: str + :ivar type_name: Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :type type_name: str - :param form_parameters: Collection of form parameters. Required if 'contentType' value is - either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - :type form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :vartype type_name: str + :ivar form_parameters: Collection of form parameters. Required if 'contentType' value is either + 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + :vartype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar examples: Exampled defined for the representation. + :vartype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] """ _validation = { @@ -9975,35 +14664,51 @@ class RepresentationContract(msrest.serialization.Model): _attribute_map = { 'content_type': {'key': 'contentType', 'type': 'str'}, - 'sample': {'key': 'sample', 'type': 'str'}, 'schema_id': {'key': 'schemaId', 'type': 'str'}, 'type_name': {'key': 'typeName', 'type': 'str'}, 'form_parameters': {'key': 'formParameters', 'type': '[ParameterContract]'}, + 'examples': {'key': 'examples', 'type': '{ParameterExampleContract}'}, } def __init__( self, **kwargs ): + """ + :keyword content_type: Required. Specifies a registered or custom content type for this + representation, e.g. application/xml. + :paramtype content_type: str + :keyword schema_id: Schema identifier. Applicable only if 'contentType' value is neither + 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :paramtype schema_id: str + :keyword type_name: Type name defined by the schema. Applicable only if 'contentType' value is + neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :paramtype type_name: str + :keyword form_parameters: Collection of form parameters. Required if 'contentType' value is + either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + :paramtype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword examples: Exampled defined for the representation. + :paramtype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + """ super(RepresentationContract, self).__init__(**kwargs) self.content_type = kwargs['content_type'] - self.sample = kwargs.get('sample', None) self.schema_id = kwargs.get('schema_id', None) self.type_name = kwargs.get('type_name', None) self.form_parameters = kwargs.get('form_parameters', None) + self.examples = kwargs.get('examples', None) class RequestContract(msrest.serialization.Model): """Operation request details. - :param description: Operation request description. - :type description: str - :param query_parameters: Collection of operation request query parameters. - :type query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param headers: Collection of operation request headers. - :type headers: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param representations: Collection of operation request representations. - :type representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + :ivar description: Operation request description. + :vartype description: str + :ivar query_parameters: Collection of operation request query parameters. + :vartype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar headers: Collection of operation request headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar representations: Collection of operation request representations. + :vartype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] """ _attribute_map = { @@ -10017,6 +14722,16 @@ def __init__( self, **kwargs ): + """ + :keyword description: Operation request description. + :paramtype description: str + :keyword query_parameters: Collection of operation request query parameters. + :paramtype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword headers: Collection of operation request headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword representations: Collection of operation request representations. + :paramtype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + """ super(RequestContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.query_parameters = kwargs.get('query_parameters', None) @@ -10027,10 +14742,10 @@ def __init__( class RequestReportCollection(msrest.serialization.Model): """Paged Report records list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] - :param count: Total record count number across all pages. - :type count: long + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] + :ivar count: Total record count number across all pages. + :vartype count: long """ _attribute_map = { @@ -10042,6 +14757,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(RequestReportCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -10052,48 +14773,48 @@ class RequestReportRecordContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param api_id: API identifier path. /apis/{apiId}. - :type api_id: str - :param operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :type operation_id: str + :ivar api_id: API identifier path. /apis/{apiId}. + :vartype api_id: str + :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :vartype operation_id: str :ivar product_id: Product identifier path. /products/{productId}. :vartype product_id: str :ivar user_id: User identifier path. /users/{userId}. :vartype user_id: str - :param method: The HTTP method associated with this request.. - :type method: str - :param url: The full URL associated with this request. - :type url: str - :param ip_address: The client IP address associated with this request. - :type ip_address: str - :param backend_response_code: The HTTP status code received by the gateway as a result of + :ivar method: The HTTP method associated with this request.. + :vartype method: str + :ivar url: The full URL associated with this request. + :vartype url: str + :ivar ip_address: The client IP address associated with this request. + :vartype ip_address: str + :ivar backend_response_code: The HTTP status code received by the gateway as a result of forwarding this request to the backend. - :type backend_response_code: str - :param response_code: The HTTP status code returned by the gateway. - :type response_code: int - :param response_size: The size of the response returned by the gateway. - :type response_size: int - :param timestamp: The date and time when this request was received by the gateway in ISO 8601 + :vartype backend_response_code: str + :ivar response_code: The HTTP status code returned by the gateway. + :vartype response_code: int + :ivar response_size: The size of the response returned by the gateway. + :vartype response_size: int + :ivar timestamp: The date and time when this request was received by the gateway in ISO 8601 format. - :type timestamp: ~datetime.datetime - :param cache: Specifies if response cache was involved in generating the response. If the value + :vartype timestamp: ~datetime.datetime + :ivar cache: Specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. - :type cache: str - :param api_time: The total time it took to process this request. - :type api_time: float - :param service_time: he time it took to forward this request to the backend and get the - response back. - :type service_time: float - :param api_region: Azure region where the gateway that processed this request is located. - :type api_region: str - :param subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :type subscription_id: str - :param request_id: Request Identifier. - :type request_id: str - :param request_size: The size of this request.. - :type request_size: int + :vartype cache: str + :ivar api_time: The total time it took to process this request. + :vartype api_time: float + :ivar service_time: he time it took to forward this request to the backend and get the response + back. + :vartype service_time: float + :ivar api_region: Azure region where the gateway that processed this request is located. + :vartype api_region: str + :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :vartype subscription_id: str + :ivar request_id: Request Identifier. + :vartype request_id: str + :ivar request_size: The size of this request.. + :vartype request_size: int """ _validation = { @@ -10126,6 +14847,46 @@ def __init__( self, **kwargs ): + """ + :keyword api_id: API identifier path. /apis/{apiId}. + :paramtype api_id: str + :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :paramtype operation_id: str + :keyword method: The HTTP method associated with this request.. + :paramtype method: str + :keyword url: The full URL associated with this request. + :paramtype url: str + :keyword ip_address: The client IP address associated with this request. + :paramtype ip_address: str + :keyword backend_response_code: The HTTP status code received by the gateway as a result of + forwarding this request to the backend. + :paramtype backend_response_code: str + :keyword response_code: The HTTP status code returned by the gateway. + :paramtype response_code: int + :keyword response_size: The size of the response returned by the gateway. + :paramtype response_size: int + :keyword timestamp: The date and time when this request was received by the gateway in ISO 8601 + format. + :paramtype timestamp: ~datetime.datetime + :keyword cache: Specifies if response cache was involved in generating the response. If the + value is none, the cache was not used. If the value is hit, cached response was returned. If + the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled + by the backend. + :paramtype cache: str + :keyword api_time: The total time it took to process this request. + :paramtype api_time: float + :keyword service_time: he time it took to forward this request to the backend and get the + response back. + :paramtype service_time: float + :keyword api_region: Azure region where the gateway that processed this request is located. + :paramtype api_region: str + :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :paramtype subscription_id: str + :keyword request_id: Request Identifier. + :paramtype request_id: str + :keyword request_size: The size of this request.. + :paramtype request_size: int + """ super(RequestReportRecordContract, self).__init__(**kwargs) self.api_id = kwargs.get('api_id', None) self.operation_id = kwargs.get('operation_id', None) @@ -10152,14 +14913,14 @@ class ResourceLocationDataContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. A canonical name for the geographic or physical location. - :type name: str - :param city: The city or locality where the resource is located. - :type city: str - :param district: The district, state, or province where the resource is located. - :type district: str - :param country_or_region: The country or region where the resource is located. - :type country_or_region: str + :ivar name: Required. A canonical name for the geographic or physical location. + :vartype name: str + :ivar city: The city or locality where the resource is located. + :vartype city: str + :ivar district: The district, state, or province where the resource is located. + :vartype district: str + :ivar country_or_region: The country or region where the resource is located. + :vartype country_or_region: str """ _validation = { @@ -10180,6 +14941,16 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. A canonical name for the geographic or physical location. + :paramtype name: str + :keyword city: The city or locality where the resource is located. + :paramtype city: str + :keyword district: The district, state, or province where the resource is located. + :paramtype district: str + :keyword country_or_region: The country or region where the resource is located. + :paramtype country_or_region: str + """ super(ResourceLocationDataContract, self).__init__(**kwargs) self.name = kwargs['name'] self.city = kwargs.get('city', None) @@ -10190,9 +14961,9 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available API Management SKU. - :param name: Name of the Sku. Possible values include: "Developer", "Standard", "Premium", + :ivar name: Name of the Sku. Possible values include: "Developer", "Standard", "Premium", "Basic", "Consumption", "Isolated". - :type name: str or ~azure.mgmt.apimanagement.models.SkuType + :vartype name: str or ~azure.mgmt.apimanagement.models.SkuType """ _attribute_map = { @@ -10203,6 +14974,11 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the Sku. Possible values include: "Developer", "Standard", "Premium", + "Basic", "Consumption", "Isolated". + :paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType + """ super(ResourceSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) @@ -10241,6 +15017,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -10277,6 +15055,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuResult, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -10288,10 +15068,10 @@ class ResourceSkuResults(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the service. - :type value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] - :param next_link: The uri to fetch the next page of API Management service Skus. - :type next_link: str + :ivar value: Required. The list of skus available for the service. + :vartype value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] + :ivar next_link: The uri to fetch the next page of API Management service Skus. + :vartype next_link: str """ _validation = { @@ -10307,6 +15087,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: Required. The list of skus available for the service. + :paramtype value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] + :keyword next_link: The uri to fetch the next page of API Management service Skus. + :paramtype next_link: str + """ super(ResourceSkuResults, self).__init__(**kwargs) self.value = kwargs['value'] self.next_link = kwargs.get('next_link', None) @@ -10317,14 +15103,14 @@ class ResponseContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status_code: Required. Operation response HTTP status code. - :type status_code: int - :param description: Operation response description. - :type description: str - :param representations: Collection of operation response representations. - :type representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] - :param headers: Collection of operation response headers. - :type headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar status_code: Required. Operation response HTTP status code. + :vartype status_code: int + :ivar description: Operation response description. + :vartype description: str + :ivar representations: Collection of operation response representations. + :vartype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + :ivar headers: Collection of operation response headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] """ _validation = { @@ -10342,6 +15128,16 @@ def __init__( self, **kwargs ): + """ + :keyword status_code: Required. Operation response HTTP status code. + :paramtype status_code: int + :keyword description: Operation response description. + :paramtype description: str + :keyword representations: Collection of operation response representations. + :paramtype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + :keyword headers: Collection of operation response headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + """ super(ResponseContract, self).__init__(**kwargs) self.status_code = kwargs['status_code'] self.description = kwargs.get('description', None) @@ -10352,10 +15148,10 @@ def __init__( class SamplingSettings(msrest.serialization.Model): """Sampling settings for Diagnostic. - :param sampling_type: Sampling type. Possible values include: "fixed". - :type sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType - :param percentage: Rate of sampling for fixed-rate sampling. - :type percentage: float + :ivar sampling_type: Sampling type. Possible values include: "fixed". + :vartype sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType + :ivar percentage: Rate of sampling for fixed-rate sampling. + :vartype percentage: float """ _validation = { @@ -10371,6 +15167,12 @@ def __init__( self, **kwargs ): + """ + :keyword sampling_type: Sampling type. Possible values include: "fixed". + :paramtype sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType + :keyword percentage: Rate of sampling for fixed-rate sampling. + :paramtype percentage: float + """ super(SamplingSettings, self).__init__(**kwargs) self.sampling_type = kwargs.get('sampling_type', None) self.percentage = kwargs.get('percentage', None) @@ -10379,12 +15181,11 @@ def __init__( class SaveConfigurationParameter(msrest.serialization.Model): """Save Tenant Configuration Contract details. - :param branch: The name of the Git branch in which to commit the current configuration - snapshot. - :type branch: str - :param force: The value if true, the current configuration database is committed to the Git + :ivar branch: The name of the Git branch in which to commit the current configuration snapshot. + :vartype branch: str + :ivar force: The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. - :type force: bool + :vartype force: bool """ _attribute_map = { @@ -10396,6 +15197,14 @@ def __init__( self, **kwargs ): + """ + :keyword branch: The name of the Git branch in which to commit the current configuration + snapshot. + :paramtype branch: str + :keyword force: The value if true, the current configuration database is committed to the Git + repository, even if the Git repository has newer changes that would be overwritten. + :paramtype force: bool + """ super(SaveConfigurationParameter, self).__init__(**kwargs) self.branch = kwargs.get('branch', None) self.force = kwargs.get('force', None) @@ -10406,10 +15215,10 @@ class SchemaCollection(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Api Schema Contract value. + :ivar value: API Schema Contract value. :vartype value: list[~azure.mgmt.apimanagement.models.SchemaContract] - :param count: Total record count number. - :type count: long + :ivar count: Total record count number. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -10429,6 +15238,10 @@ def __init__( self, **kwargs ): + """ + :keyword count: Total record count number. + :paramtype count: long + """ super(SchemaCollection, self).__init__(**kwargs) self.value = None self.count = kwargs.get('count', None) @@ -10436,28 +15249,33 @@ def __init__( class SchemaContract(Resource): - """Schema Contract details. + """API Schema Contract details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param content_type: Must be a valid a media type used in a Content-Type header as defined in + :ivar content_type: Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- ``Swagger`` Schema use ``application/vnd.ms-azure-apim.swagger.definitions+json``
- ``WSDL`` Schema use ``application/vnd.ms-azure-apim.xsd+xml``
- ``OpenApi`` Schema use ``application/vnd.oai.openapi.components+json``
- ``WADL Schema`` use ``application/vnd.ms-azure-apim.wadl.grammars+xml``. - :type content_type: str - :param value: Json escaped string defining the document representing the Schema. Used for + :vartype content_type: str + :ivar value: Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. - :type value: str - :param definitions: Types definitions. Used for Swagger/OpenAPI schemas only, null otherwise. - :type definitions: any + :vartype value: str + :ivar definitions: Types definitions. Used for Swagger/OpenAPI v1 schemas only, null otherwise. + :vartype definitions: any + :ivar components: Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null + otherwise. + :vartype components: any """ _validation = { @@ -10473,27 +15291,47 @@ class SchemaContract(Resource): 'content_type': {'key': 'properties.contentType', 'type': 'str'}, 'value': {'key': 'properties.document.value', 'type': 'str'}, 'definitions': {'key': 'properties.document.definitions', 'type': 'object'}, + 'components': {'key': 'properties.document.components', 'type': 'object'}, } def __init__( self, **kwargs ): + """ + :keyword content_type: Must be a valid a media type used in a Content-Type header as defined in + the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
+ - ``Swagger`` Schema use ``application/vnd.ms-azure-apim.swagger.definitions+json``
- + ``WSDL`` Schema use ``application/vnd.ms-azure-apim.xsd+xml``
- ``OpenApi`` Schema use + ``application/vnd.oai.openapi.components+json``
- ``WADL Schema`` use + ``application/vnd.ms-azure-apim.wadl.grammars+xml``. + :paramtype content_type: str + :keyword value: Json escaped string defining the document representing the Schema. Used for + schemas other than Swagger/OpenAPI. + :paramtype value: str + :keyword definitions: Types definitions. Used for Swagger/OpenAPI v1 schemas only, null + otherwise. + :paramtype definitions: any + :keyword components: Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null + otherwise. + :paramtype components: any + """ super(SchemaContract, self).__init__(**kwargs) self.content_type = kwargs.get('content_type', None) self.value = kwargs.get('value', None) self.definitions = kwargs.get('definitions', None) + self.components = kwargs.get('components', None) class SubscriptionCollection(msrest.serialization.Model): """Paged Subscriptions list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10506,6 +15344,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(SubscriptionCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -10517,20 +15363,22 @@ class SubscriptionContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param owner_id: The user resource identifier of the subscription owner. The value is a valid + :ivar owner_id: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. - :type owner_id: str - :param scope: Scope like /products/{productId} or /apis or /apis/{apiId}. - :type scope: str - :param display_name: The name of the subscription, or null if the subscription has no name. - :type display_name: str - :param state: Subscription state. Possible states are * active – the subscription is active, * + :vartype owner_id: str + :ivar scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :vartype scope: str + :ivar display_name: The name of the subscription, or null if the subscription has no name. + :vartype display_name: str + :ivar state: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an @@ -10538,39 +15386,39 @@ class SubscriptionContract(Resource): administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: "suspended", "active", "expired", "submitted", "rejected", "cancelled". - :type state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :vartype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState :ivar created_date: Subscription creation date. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. :vartype created_date: ~datetime.datetime - :param start_date: Subscription activation date. The setting is for audit purposes only and the + :ivar start_date: Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type start_date: ~datetime.datetime - :param expiration_date: Subscription expiration date. The setting is for audit purposes only - and the subscription is not automatically expired. The subscription lifecycle can be managed by + :vartype start_date: ~datetime.datetime + :ivar expiration_date: Subscription expiration date. The setting is for audit purposes only and + the subscription is not automatically expired. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiration_date: ~datetime.datetime - :param end_date: Date when subscription was cancelled or expired. The setting is for audit + :vartype expiration_date: ~datetime.datetime + :ivar end_date: Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type end_date: ~datetime.datetime - :param notification_date: Upcoming subscription expiration notification date. The date conforms + :vartype end_date: ~datetime.datetime + :ivar notification_date: Upcoming subscription expiration notification date. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type notification_date: ~datetime.datetime - :param primary_key: Subscription primary key. This property will not be filled on 'GET' + :vartype notification_date: ~datetime.datetime + :ivar primary_key: Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type primary_key: str - :param secondary_key: Subscription secondary key. This property will not be filled on 'GET' + :vartype primary_key: str + :ivar secondary_key: Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type secondary_key: str - :param state_comment: Optional subscription comment added by an administrator when the state is + :vartype secondary_key: str + :ivar state_comment: Optional subscription comment added by an 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 + :vartype state_comment: str + :ivar allow_tracing: Determines whether tracing is enabled. + :vartype allow_tracing: bool """ _validation = { @@ -10606,6 +15454,54 @@ def __init__( self, **kwargs ): + """ + :keyword owner_id: The user resource identifier of the subscription owner. The value is a valid + relative URL in the format of /users/{userId} where {userId} is a user identifier. + :paramtype owner_id: str + :keyword scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :paramtype scope: str + :keyword display_name: The name of the subscription, or null if the subscription has no name. + :paramtype display_name: str + :keyword state: Subscription state. Possible states are * active – the subscription is active, + * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the + product, * submitted – the subscription request has been made by the developer, but has not yet + been approved or rejected, * rejected – the subscription request has been denied by an + administrator, * cancelled – the subscription has been cancelled by the developer or + administrator, * expired – the subscription reached its expiration date and was deactivated. + Possible values include: "suspended", "active", "expired", "submitted", "rejected", + "cancelled". + :paramtype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :keyword start_date: Subscription activation date. The setting is for audit purposes only and + the subscription is not automatically activated. The subscription lifecycle can be managed by + using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype start_date: ~datetime.datetime + :keyword expiration_date: Subscription expiration date. The setting is for audit purposes only + and the subscription is not automatically expired. The subscription lifecycle can be managed by + using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiration_date: ~datetime.datetime + :keyword end_date: Date when subscription was cancelled or expired. The setting is for audit + purposes only and the subscription is not automatically cancelled. The subscription lifecycle + can be managed by using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype end_date: ~datetime.datetime + :keyword notification_date: Upcoming subscription expiration notification date. The date + conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype notification_date: ~datetime.datetime + :keyword primary_key: Subscription primary key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype primary_key: str + :keyword secondary_key: Subscription secondary key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype secondary_key: str + :keyword state_comment: Optional subscription comment added by an administrator when the state + is changed to the 'rejected'. + :paramtype state_comment: str + :keyword allow_tracing: Determines whether tracing is enabled. + :paramtype allow_tracing: bool + """ super(SubscriptionContract, self).__init__(**kwargs) self.owner_id = kwargs.get('owner_id', None) self.scope = kwargs.get('scope', None) @@ -10625,31 +15521,30 @@ def __init__( class SubscriptionCreateParameters(msrest.serialization.Model): """Subscription create details. - :param owner_id: User (user id path) for whom subscription is being created in form + :ivar owner_id: User (user id path) for whom subscription is being created in form /users/{userId}. - :type owner_id: str - :param scope: Scope like /products/{productId} or /apis or /apis/{apiId}. - :type scope: str - :param display_name: Subscription name. - :type display_name: str - :param primary_key: Primary subscription key. If not specified during request key will be + :vartype owner_id: str + :ivar scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :vartype scope: str + :ivar display_name: Subscription name. + :vartype display_name: str + :ivar primary_key: Primary subscription key. If not specified during request key will be generated automatically. - :type primary_key: str - :param secondary_key: Secondary subscription key. If not specified during request key will be + :vartype primary_key: str + :ivar secondary_key: Secondary subscription key. If not specified during request key will be generated automatically. - :type secondary_key: str - :param state: Initial subscription state. If no value is specified, subscription is created - with Submitted state. Possible states are * active – the subscription is active, * suspended – - the subscription is blocked, and the subscriber cannot call any APIs of the product, * - submitted – the subscription request has been made by the developer, but has not yet been - approved or rejected, * rejected – the subscription request has been denied by an - administrator, * cancelled – the subscription has been cancelled by the developer or - administrator, * expired – the subscription reached its expiration date and was deactivated. - Possible values include: "suspended", "active", "expired", "submitted", "rejected", - "cancelled". - :type state: str or ~azure.mgmt.apimanagement.models.SubscriptionState - :param allow_tracing: Determines whether tracing can be enabled. - :type allow_tracing: bool + :vartype secondary_key: str + :ivar state: Initial subscription state. If no value is specified, subscription is created with + Submitted state. Possible states are * active – the subscription is active, * suspended – the + subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – + the subscription request has been made by the developer, but has not yet been approved or + rejected, * rejected – the subscription request has been denied by an administrator, * + cancelled – the subscription has been cancelled by the developer or administrator, * expired – + the subscription reached its expiration date and was deactivated. Possible values include: + "suspended", "active", "expired", "submitted", "rejected", "cancelled". + :vartype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :ivar allow_tracing: Determines whether tracing can be enabled. + :vartype allow_tracing: bool """ _validation = { @@ -10672,6 +15567,33 @@ def __init__( self, **kwargs ): + """ + :keyword owner_id: User (user id path) for whom subscription is being created in form + /users/{userId}. + :paramtype owner_id: str + :keyword scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :paramtype scope: str + :keyword display_name: Subscription name. + :paramtype display_name: str + :keyword primary_key: Primary subscription key. If not specified during request key will be + generated automatically. + :paramtype primary_key: str + :keyword secondary_key: Secondary subscription key. If not specified during request key will be + generated automatically. + :paramtype secondary_key: str + :keyword state: Initial subscription state. If no value is specified, subscription is created + with Submitted state. Possible states are * active – the subscription is active, * suspended – + the subscription is blocked, and the subscriber cannot call any APIs of the product, * + submitted – the subscription request has been made by the developer, but has not yet been + approved or rejected, * rejected – the subscription request has been denied by an + administrator, * cancelled – the subscription has been cancelled by the developer or + administrator, * expired – the subscription reached its expiration date and was deactivated. + Possible values include: "suspended", "active", "expired", "submitted", "rejected", + "cancelled". + :paramtype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :keyword allow_tracing: Determines whether tracing can be enabled. + :paramtype allow_tracing: bool + """ super(SubscriptionCreateParameters, self).__init__(**kwargs) self.owner_id = kwargs.get('owner_id', None) self.scope = kwargs.get('scope', None) @@ -10685,10 +15607,10 @@ def __init__( class SubscriptionKeyParameterNamesContract(msrest.serialization.Model): """Subscription key parameter names details. - :param header: Subscription key header name. - :type header: str - :param query: Subscription key query string parameter name. - :type query: str + :ivar header: Subscription key header name. + :vartype header: str + :ivar query: Subscription key query string parameter name. + :vartype query: str """ _attribute_map = { @@ -10700,6 +15622,12 @@ def __init__( self, **kwargs ): + """ + :keyword header: Subscription key header name. + :paramtype header: str + :keyword query: Subscription key query string parameter name. + :paramtype query: str + """ super(SubscriptionKeyParameterNamesContract, self).__init__(**kwargs) self.header = kwargs.get('header', None) self.query = kwargs.get('query', None) @@ -10708,10 +15636,10 @@ def __init__( class SubscriptionKeysContract(msrest.serialization.Model): """Subscription keys. - :param primary_key: Subscription primary key. - :type primary_key: str - :param secondary_key: Subscription secondary key. - :type secondary_key: str + :ivar primary_key: Subscription primary key. + :vartype primary_key: str + :ivar secondary_key: Subscription secondary key. + :vartype secondary_key: str """ _validation = { @@ -10728,6 +15656,12 @@ def __init__( self, **kwargs ): + """ + :keyword primary_key: Subscription primary key. + :paramtype primary_key: str + :keyword secondary_key: Subscription secondary key. + :paramtype secondary_key: str + """ super(SubscriptionKeysContract, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -10736,8 +15670,8 @@ def __init__( class SubscriptionsDelegationSettingsProperties(msrest.serialization.Model): """Subscriptions delegation settings properties. - :param enabled: Enable or disable delegation for subscriptions. - :type enabled: bool + :ivar enabled: Enable or disable delegation for subscriptions. + :vartype enabled: bool """ _attribute_map = { @@ -10748,6 +15682,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Enable or disable delegation for subscriptions. + :paramtype enabled: bool + """ super(SubscriptionsDelegationSettingsProperties, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -10755,22 +15693,22 @@ def __init__( class SubscriptionUpdateParameters(msrest.serialization.Model): """Subscription update details. - :param owner_id: User identifier path: /users/{userId}. - :type owner_id: str - :param scope: Scope like /products/{productId} or /apis or /apis/{apiId}. - :type scope: str - :param expiration_date: Subscription expiration date. The setting is for audit purposes only - and the subscription is not automatically expired. The subscription lifecycle can be managed by + :ivar owner_id: User identifier path: /users/{userId}. + :vartype owner_id: str + :ivar scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :vartype scope: str + :ivar expiration_date: Subscription expiration date. The setting is for audit purposes only and + the subscription is not automatically expired. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiration_date: ~datetime.datetime - :param display_name: Subscription name. - :type display_name: str - :param primary_key: Primary subscription key. - :type primary_key: str - :param secondary_key: Secondary subscription key. - :type secondary_key: str - :param state: Subscription state. Possible states are * active – the subscription is active, * + :vartype expiration_date: ~datetime.datetime + :ivar display_name: Subscription name. + :vartype display_name: str + :ivar primary_key: Primary subscription key. + :vartype primary_key: str + :ivar secondary_key: Secondary subscription key. + :vartype secondary_key: str + :ivar state: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an @@ -10778,12 +15716,12 @@ class SubscriptionUpdateParameters(msrest.serialization.Model): administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: "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 when + :vartype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :ivar state_comment: Comments describing subscription state change by the 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 + :vartype state_comment: str + :ivar allow_tracing: Determines whether tracing can be enabled. + :vartype allow_tracing: bool """ _validation = { @@ -10807,6 +15745,37 @@ def __init__( self, **kwargs ): + """ + :keyword owner_id: User identifier path: /users/{userId}. + :paramtype owner_id: str + :keyword scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :paramtype scope: str + :keyword expiration_date: Subscription expiration date. The setting is for audit purposes only + and the subscription is not automatically expired. The subscription lifecycle can be managed by + using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiration_date: ~datetime.datetime + :keyword display_name: Subscription name. + :paramtype display_name: str + :keyword primary_key: Primary subscription key. + :paramtype primary_key: str + :keyword secondary_key: Secondary subscription key. + :paramtype secondary_key: str + :keyword state: Subscription state. Possible states are * active – the subscription is active, + * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the + product, * submitted – the subscription request has been made by the developer, but has not yet + been approved or rejected, * rejected – the subscription request has been denied by an + administrator, * cancelled – the subscription has been cancelled by the developer or + administrator, * expired – the subscription reached its expiration date and was deactivated. + Possible values include: "suspended", "active", "expired", "submitted", "rejected", + "cancelled". + :paramtype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :keyword state_comment: Comments describing subscription state change by the administrator when + the state is changed to the 'rejected'. + :paramtype state_comment: str + :keyword allow_tracing: Determines whether tracing can be enabled. + :paramtype allow_tracing: bool + """ super(SubscriptionUpdateParameters, self).__init__(**kwargs) self.owner_id = kwargs.get('owner_id', None) self.scope = kwargs.get('scope', None) @@ -10819,15 +15788,72 @@ def __init__( self.allow_tracing = kwargs.get('allow_tracing', None) +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + class TagCollection(msrest.serialization.Model): """Paged Tag list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.TagContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.TagContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10840,6 +15866,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.TagContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(TagCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -10851,14 +15885,16 @@ class TagContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param display_name: Tag name. - :type display_name: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -10879,6 +15915,10 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagContract, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) @@ -10886,8 +15926,8 @@ def __init__( class TagCreateUpdateParameters(msrest.serialization.Model): """Parameters supplied to Create/Update Tag operations. - :param display_name: Tag name. - :type display_name: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -10902,6 +15942,10 @@ def __init__( self, **kwargs ): + """ + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagCreateUpdateParameters, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) @@ -10909,12 +15953,12 @@ def __init__( class TagDescriptionBaseProperties(msrest.serialization.Model): """Parameters supplied to the Create TagDescription operation. - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str """ _validation = { @@ -10931,6 +15975,14 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + """ super(TagDescriptionBaseProperties, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.external_docs_url = kwargs.get('external_docs_url', None) @@ -10940,12 +15992,12 @@ def __init__( class TagDescriptionCollection(msrest.serialization.Model): """Paged TagDescription list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10958,6 +16010,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(TagDescriptionCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -10969,22 +16029,24 @@ class TagDescriptionContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str - :param tag_id: Identifier of the tag in the form of /tags/{tagId}. - :type tag_id: str - :param display_name: Tag name. - :type display_name: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str + :ivar tag_id: Identifier of the tag in the form of /tags/{tagId}. + :vartype tag_id: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -11010,6 +16072,18 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + :keyword tag_id: Identifier of the tag in the form of /tags/{tagId}. + :paramtype tag_id: str + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagDescriptionContract, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.external_docs_url = kwargs.get('external_docs_url', None) @@ -11021,16 +16095,16 @@ def __init__( class TagDescriptionContractProperties(TagDescriptionBaseProperties): """TagDescription contract Properties. - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str - :param tag_id: Identifier of the tag in the form of /tags/{tagId}. - :type tag_id: str - :param display_name: Tag name. - :type display_name: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str + :ivar tag_id: Identifier of the tag in the form of /tags/{tagId}. + :vartype tag_id: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -11050,6 +16124,18 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + :keyword tag_id: Identifier of the tag in the form of /tags/{tagId}. + :paramtype tag_id: str + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagDescriptionContractProperties, self).__init__(**kwargs) self.tag_id = kwargs.get('tag_id', None) self.display_name = kwargs.get('display_name', None) @@ -11058,12 +16144,12 @@ def __init__( class TagDescriptionCreateParameters(msrest.serialization.Model): """Parameters supplied to the Create TagDescription operation. - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str """ _validation = { @@ -11080,6 +16166,14 @@ def __init__( self, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + """ super(TagDescriptionCreateParameters, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.external_docs_url = kwargs.get('external_docs_url', None) @@ -11089,12 +16183,12 @@ def __init__( class TagResourceCollection(msrest.serialization.Model): """Paged Tag list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.TagResourceContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.TagResourceContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -11107,6 +16201,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.TagResourceContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(TagResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -11118,14 +16220,14 @@ class TagResourceContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tag: Required. Tag associated with the resource. - :type tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties - :param api: Api associated with the tag. - :type api: ~azure.mgmt.apimanagement.models.ApiTagResourceContractProperties - :param operation: Operation associated with the tag. - :type operation: ~azure.mgmt.apimanagement.models.OperationTagResourceContractProperties - :param product: Product associated with the tag. - :type product: ~azure.mgmt.apimanagement.models.ProductTagResourceContractProperties + :ivar tag: Required. Tag associated with the resource. + :vartype tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties + :ivar api: API associated with the tag. + :vartype api: ~azure.mgmt.apimanagement.models.ApiTagResourceContractProperties + :ivar operation: Operation associated with the tag. + :vartype operation: ~azure.mgmt.apimanagement.models.OperationTagResourceContractProperties + :ivar product: Product associated with the tag. + :vartype product: ~azure.mgmt.apimanagement.models.ProductTagResourceContractProperties """ _validation = { @@ -11143,6 +16245,16 @@ def __init__( self, **kwargs ): + """ + :keyword tag: Required. Tag associated with the resource. + :paramtype tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties + :keyword api: API associated with the tag. + :paramtype api: ~azure.mgmt.apimanagement.models.ApiTagResourceContractProperties + :keyword operation: Operation associated with the tag. + :paramtype operation: ~azure.mgmt.apimanagement.models.OperationTagResourceContractProperties + :keyword product: Product associated with the tag. + :paramtype product: ~azure.mgmt.apimanagement.models.ProductTagResourceContractProperties + """ super(TagResourceContract, self).__init__(**kwargs) self.tag = kwargs['tag'] self.api = kwargs.get('api', None) @@ -11153,10 +16265,10 @@ def __init__( class TagResourceContractProperties(msrest.serialization.Model): """Contract defining the Tag property in the Tag Resource Contract. - :param id: Tag identifier. - :type id: str - :param name: Tag Name. - :type name: str + :ivar id: Tag identifier. + :vartype id: str + :ivar name: Tag Name. + :vartype name: str """ _validation = { @@ -11172,37 +16284,61 @@ def __init__( self, **kwargs ): + """ + :keyword id: Tag identifier. + :paramtype id: str + :keyword name: Tag Name. + :paramtype name: str + """ super(TagResourceContractProperties, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) -class TenantConfigurationSyncStateContract(msrest.serialization.Model): +class TenantConfigurationSyncStateContract(Resource): """Result of Tenant Configuration Sync State. - :param branch: The name of Git branch. - :type branch: str - :param commit_id: The latest commit Id. - :type commit_id: str - :param is_export: value indicating if last sync was save (true) or deploy (false) operation. - :type is_export: bool - :param is_synced: value indicating if last synchronization was later than the configuration + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar branch: The name of Git branch. + :vartype branch: str + :ivar commit_id: The latest commit Id. + :vartype commit_id: str + :ivar is_export: value indicating if last sync was save (true) or deploy (false) operation. + :vartype is_export: bool + :ivar is_synced: value indicating if last synchronization was later than the configuration change. - :type is_synced: bool - :param is_git_enabled: value indicating whether Git configuration access is enabled. - :type is_git_enabled: bool - :param sync_date: The date of the latest synchronization. The date conforms to the following + :vartype is_synced: bool + :ivar is_git_enabled: value indicating whether Git configuration access is enabled. + :vartype is_git_enabled: bool + :ivar sync_date: The date of the latest synchronization. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type sync_date: ~datetime.datetime - :param configuration_change_date: The date of the latest configuration change. The date - conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 - standard. - :type configuration_change_date: ~datetime.datetime - :param last_operation_id: Most recent tenant configuration operation identifier. - :type last_operation_id: str + :vartype sync_date: ~datetime.datetime + :ivar configuration_change_date: The date of the latest configuration change. The date conforms + to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype configuration_change_date: ~datetime.datetime + :ivar last_operation_id: Most recent tenant configuration operation identifier. + :vartype last_operation_id: 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'}, 'branch': {'key': 'properties.branch', 'type': 'str'}, 'commit_id': {'key': 'properties.commitId', 'type': 'str'}, 'is_export': {'key': 'properties.isExport', 'type': 'bool'}, @@ -11217,6 +16353,28 @@ def __init__( self, **kwargs ): + """ + :keyword branch: The name of Git branch. + :paramtype branch: str + :keyword commit_id: The latest commit Id. + :paramtype commit_id: str + :keyword is_export: value indicating if last sync was save (true) or deploy (false) operation. + :paramtype is_export: bool + :keyword is_synced: value indicating if last synchronization was later than the configuration + change. + :paramtype is_synced: bool + :keyword is_git_enabled: value indicating whether Git configuration access is enabled. + :paramtype is_git_enabled: bool + :keyword sync_date: The date of the latest synchronization. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype sync_date: ~datetime.datetime + :keyword configuration_change_date: The date of the latest configuration change. The date + conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype configuration_change_date: ~datetime.datetime + :keyword last_operation_id: Most recent tenant configuration operation identifier. + :paramtype last_operation_id: str + """ super(TenantConfigurationSyncStateContract, self).__init__(**kwargs) self.branch = kwargs.get('branch', None) self.commit_id = kwargs.get('commit_id', None) @@ -11253,6 +16411,8 @@ def __init__( self, **kwargs ): + """ + """ super(TenantSettingsCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -11263,14 +16423,16 @@ class TenantSettingsContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param settings: Tenant settings. - :type settings: dict[str, str] + :ivar settings: Tenant settings. + :vartype settings: dict[str, str] """ _validation = { @@ -11290,6 +16452,10 @@ def __init__( self, **kwargs ): + """ + :keyword settings: Tenant settings. + :paramtype settings: dict[str, str] + """ super(TenantSettingsContract, self).__init__(**kwargs) self.settings = kwargs.get('settings', None) @@ -11297,12 +16463,12 @@ def __init__( class TermsOfServiceProperties(msrest.serialization.Model): """Terms of service contract properties. - :param text: A terms of service text. - :type text: str - :param enabled: Display terms of service during a sign-up process. - :type enabled: bool - :param consent_required: Ask user for consent to the terms of service. - :type consent_required: bool + :ivar text: A terms of service text. + :vartype text: str + :ivar enabled: Display terms of service during a sign-up process. + :vartype enabled: bool + :ivar consent_required: Ask user for consent to the terms of service. + :vartype consent_required: bool """ _attribute_map = { @@ -11315,6 +16481,14 @@ def __init__( self, **kwargs ): + """ + :keyword text: A terms of service text. + :paramtype text: str + :keyword enabled: Display terms of service during a sign-up process. + :paramtype enabled: bool + :keyword consent_required: Ask user for consent to the terms of service. + :paramtype consent_required: bool + """ super(TermsOfServiceProperties, self).__init__(**kwargs) self.text = kwargs.get('text', None) self.enabled = kwargs.get('enabled', None) @@ -11326,10 +16500,10 @@ class TokenBodyParameterContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. body parameter name. - :type name: str - :param value: Required. body parameter value. - :type value: str + :ivar name: Required. body parameter name. + :vartype name: str + :ivar value: Required. body parameter value. + :vartype value: str """ _validation = { @@ -11346,6 +16520,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. body parameter name. + :paramtype name: str + :keyword value: Required. body parameter value. + :paramtype value: str + """ super(TokenBodyParameterContract, self).__init__(**kwargs) self.name = kwargs['name'] self.value = kwargs['value'] @@ -11354,12 +16534,12 @@ def __init__( class UserCollection(msrest.serialization.Model): """Paged Users list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.UserContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.UserContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -11372,6 +16552,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.UserContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(UserCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -11383,30 +16571,32 @@ class UserContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param email: Email address. - :type email: str - :param registration_date: Date of user registration. The date conforms to the following format: + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar email: Email address. + :vartype email: str + :ivar registration_date: Date of user registration. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type registration_date: ~datetime.datetime + :vartype registration_date: ~datetime.datetime :ivar groups: Collection of groups user is part of. :vartype groups: list[~azure.mgmt.apimanagement.models.GroupContractProperties] """ @@ -11436,6 +16626,26 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword email: Email address. + :paramtype email: str + :keyword registration_date: Date of user registration. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype registration_date: ~datetime.datetime + """ super(UserContract, self).__init__(**kwargs) self.state = kwargs.get('state', "active") self.note = kwargs.get('note', None) @@ -11450,15 +16660,15 @@ def __init__( class UserEntityBaseParameters(msrest.serialization.Model): """User Entity Base Parameters set. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] """ _attribute_map = { @@ -11471,6 +16681,17 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + """ super(UserEntityBaseParameters, self).__init__(**kwargs) self.state = kwargs.get('state', "active") self.note = kwargs.get('note', None) @@ -11482,24 +16703,24 @@ class UserContractProperties(UserEntityBaseParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param email: Email address. - :type email: str - :param registration_date: Date of user registration. The date conforms to the following format: + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar email: Email address. + :vartype email: str + :ivar registration_date: Date of user registration. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type registration_date: ~datetime.datetime + :vartype registration_date: ~datetime.datetime :ivar groups: Collection of groups user is part of. :vartype groups: list[~azure.mgmt.apimanagement.models.GroupContractProperties] """ @@ -11523,6 +16744,26 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword email: Email address. + :paramtype email: str + :keyword registration_date: Date of user registration. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype registration_date: ~datetime.datetime + """ super(UserContractProperties, self).__init__(**kwargs) self.first_name = kwargs.get('first_name', None) self.last_name = kwargs.get('last_name', None) @@ -11536,30 +16777,30 @@ class UserCreateParameterProperties(UserEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Required. Email address. Must not be empty and must be unique within the service + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Required. Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param first_name: Required. First name. - :type first_name: str - :param last_name: Required. Last name. - :type last_name: str - :param password: User Password. If no value is provided, a default password is generated. - :type password: str - :param app_type: Determines the type of application which send the create user request. Default + :vartype email: str + :ivar first_name: Required. First name. + :vartype first_name: str + :ivar last_name: Required. Last name. + :vartype last_name: str + :ivar password: User Password. If no value is provided, a default password is generated. + :vartype password: str + :ivar app_type: Determines the type of application which send the create 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 be sent to the newly + :vartype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :ivar confirmation: Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: "signup", "invite". - :type confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + :vartype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation """ _validation = { @@ -11584,6 +16825,32 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Required. Email address. Must not be empty and must be unique within the + service instance. + :paramtype email: str + :keyword first_name: Required. First name. + :paramtype first_name: str + :keyword last_name: Required. Last name. + :paramtype last_name: str + :keyword password: User Password. If no value is provided, a default password is generated. + :paramtype password: str + :keyword app_type: Determines the type of application which send the create user request. + Default is legacy portal. Possible values include: "portal", "developerPortal". + :paramtype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :keyword confirmation: Determines the type of confirmation e-mail that will be sent to the + newly created user. Possible values include: "signup", "invite". + :paramtype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + """ super(UserCreateParameterProperties, self).__init__(**kwargs) self.email = kwargs['email'] self.first_name = kwargs['first_name'] @@ -11596,29 +16863,29 @@ def __init__( class UserCreateParameters(msrest.serialization.Model): """User create details. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param password: User Password. If no value is provided, a default password is generated. - :type password: str - :param app_type: Determines the type of application which send the create user request. Default + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Email address. Must not be empty and must be unique within the service instance. + :vartype email: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar password: User Password. If no value is provided, a default password is generated. + :vartype password: str + :ivar app_type: Determines the type of application which send the create 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 be sent to the newly + :vartype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :ivar confirmation: Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: "signup", "invite". - :type confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + :vartype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation """ _validation = { @@ -11643,6 +16910,32 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Email address. Must not be empty and must be unique within the service + instance. + :paramtype email: str + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword password: User Password. If no value is provided, a default password is generated. + :paramtype password: str + :keyword app_type: Determines the type of application which send the create user request. + Default is legacy portal. Possible values include: "portal", "developerPortal". + :paramtype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :keyword confirmation: Determines the type of confirmation e-mail that will be sent to the + newly created user. Possible values include: "signup", "invite". + :paramtype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + """ super(UserCreateParameters, self).__init__(**kwargs) self.state = kwargs.get('state', "active") self.note = kwargs.get('note', None) @@ -11658,12 +16951,12 @@ def __init__( class UserIdentityCollection(msrest.serialization.Model): """List of Users Identity list representation. - :param value: User Identity values. - :type value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: User Identity values. + :vartype value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -11676,6 +16969,14 @@ def __init__( self, **kwargs ): + """ + :keyword value: User Identity values. + :paramtype value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(UserIdentityCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.count = kwargs.get('count', None) @@ -11685,10 +16986,10 @@ def __init__( class UserIdentityContract(msrest.serialization.Model): """User identity details. - :param provider: Identity provider name. - :type provider: str - :param id: Identifier value within provider. - :type id: str + :ivar provider: Identity provider name. + :vartype provider: str + :ivar id: Identifier value within provider. + :vartype id: str """ _attribute_map = { @@ -11700,6 +17001,12 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Identity provider name. + :paramtype provider: str + :keyword id: Identifier value within provider. + :paramtype id: str + """ super(UserIdentityContract, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.id = kwargs.get('id', None) @@ -11708,10 +17015,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -11723,6 +17030,12 @@ def __init__( self, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = kwargs.get('principal_id', None) self.client_id = kwargs.get('client_id', None) @@ -11731,13 +17044,13 @@ def __init__( class UserTokenParameters(msrest.serialization.Model): """Get User Token parameters. - :param key_type: The Key to be used to generate token for user. Possible values include: + :ivar key_type: The Key to be used to generate token for user. Possible values include: "primary", "secondary". - :type key_type: str or ~azure.mgmt.apimanagement.models.KeyType - :param expiry: The Expiry time of the Token. Maximum token expiry time is set to 30 days. The + :vartype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :ivar expiry: The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiry: ~datetime.datetime + :vartype expiry: ~datetime.datetime """ _attribute_map = { @@ -11749,6 +17062,15 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: The Key to be used to generate token for user. Possible values include: + "primary", "secondary". + :paramtype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :keyword expiry: The Expiry time of the Token. Maximum token expiry time is set to 30 days. The + date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype expiry: ~datetime.datetime + """ super(UserTokenParameters, self).__init__(**kwargs) self.key_type = kwargs.get('key_type', None) self.expiry = kwargs.get('expiry', None) @@ -11757,8 +17079,8 @@ def __init__( class UserTokenResult(msrest.serialization.Model): """Get User Token response details. - :param value: Shared Access Authorization token for the User. - :type value: str + :ivar value: Shared Access Authorization token for the User. + :vartype value: str """ _attribute_map = { @@ -11769,6 +17091,10 @@ def __init__( self, **kwargs ): + """ + :keyword value: Shared Access Authorization token for the User. + :paramtype value: str + """ super(UserTokenResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -11776,23 +17102,23 @@ def __init__( class UserUpdateParameters(msrest.serialization.Model): """User update parameters. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param password: User Password. - :type password: str - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Email address. Must not be empty and must be unique within the service instance. + :vartype email: str + :ivar password: User Password. + :vartype password: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str """ _validation = { @@ -11815,6 +17141,26 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Email address. Must not be empty and must be unique within the service + instance. + :paramtype email: str + :keyword password: User Password. + :paramtype password: str + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + """ super(UserUpdateParameters, self).__init__(**kwargs) self.state = kwargs.get('state', "active") self.note = kwargs.get('note', None) @@ -11828,23 +17174,23 @@ def __init__( class UserUpdateParametersProperties(UserEntityBaseParameters): """Parameters supplied to the Update User operation. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param password: User Password. - :type password: str - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Email address. Must not be empty and must be unique within the service instance. + :vartype email: str + :ivar password: User Password. + :vartype password: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str """ _validation = { @@ -11867,6 +17213,26 @@ def __init__( self, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Email address. Must not be empty and must be unique within the service + instance. + :paramtype email: str + :keyword password: User Password. + :paramtype password: str + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + """ super(UserUpdateParametersProperties, self).__init__(**kwargs) self.email = kwargs.get('email', None) self.password = kwargs.get('password', None) @@ -11883,9 +17249,9 @@ class VirtualNetworkConfiguration(msrest.serialization.Model): :vartype vnetid: str :ivar subnetname: The name of the subnet. :vartype subnetname: str - :param subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy the + :ivar subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy the API Management service in. - :type subnet_resource_id: str + :vartype subnet_resource_id: str """ _validation = { @@ -11904,6 +17270,11 @@ def __init__( self, **kwargs ): + """ + :keyword subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy + the API Management service in. + :paramtype subnet_resource_id: str + """ super(VirtualNetworkConfiguration, self).__init__(**kwargs) self.vnetid = None self.subnetname = None @@ -11913,10 +17284,10 @@ def __init__( class X509CertificateName(msrest.serialization.Model): """Properties of server X509Names. - :param name: Common Name of the Certificate. - :type name: str - :param issuer_certificate_thumbprint: Thumbprint for the Issuer of the Certificate. - :type issuer_certificate_thumbprint: str + :ivar name: Common Name of the Certificate. + :vartype name: str + :ivar issuer_certificate_thumbprint: Thumbprint for the Issuer of the Certificate. + :vartype issuer_certificate_thumbprint: str """ _attribute_map = { @@ -11928,6 +17299,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Common Name of the Certificate. + :paramtype name: str + :keyword issuer_certificate_thumbprint: Thumbprint for the Issuer of the Certificate. + :paramtype issuer_certificate_thumbprint: str + """ super(X509CertificateName, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.issuer_certificate_thumbprint = kwargs.get('issuer_certificate_thumbprint', None) 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 33a0d7303898..54a3af9cfb7d 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 @@ -22,8 +22,8 @@ class AccessInformationCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.AccessInformationContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -45,6 +45,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(AccessInformationCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -52,15 +56,17 @@ def __init__( class Resource(msrest.serialization.Model): - """The Resource definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -80,6 +86,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -91,18 +99,20 @@ class AccessInformationContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param id_properties_id: Access Information type ('access' or 'gitAccess'). - :type id_properties_id: str - :param principal_id: Principal (User) Identifier. - :type principal_id: str - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :ivar id_properties_id: Access Information type ('access' or 'gitAccess'). + :vartype id_properties_id: str + :ivar principal_id: Principal (User) Identifier. + :vartype principal_id: str + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _validation = { @@ -128,6 +138,14 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword id_properties_id: Access Information type ('access' or 'gitAccess'). + :paramtype id_properties_id: str + :keyword principal_id: Principal (User) Identifier. + :paramtype principal_id: str + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationContract, self).__init__(**kwargs) self.id_properties_id = id_properties_id self.principal_id = principal_id @@ -137,16 +155,16 @@ def __init__( class AccessInformationCreateParameters(msrest.serialization.Model): """Tenant access information update parameters. - :param principal_id: Principal (User) Identifier. - :type principal_id: str - :param primary_key: Primary access key. This property will not be filled on 'GET' operations! + :ivar principal_id: Principal (User) Identifier. + :vartype principal_id: str + :ivar primary_key: Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type primary_key: str - :param secondary_key: Secondary access key. This property will not be filled on 'GET' + :vartype primary_key: str + :ivar secondary_key: Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type secondary_key: str - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :vartype secondary_key: str + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -165,6 +183,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword principal_id: Principal (User) Identifier. + :paramtype principal_id: str + :keyword primary_key: Primary access key. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype primary_key: str + :keyword secondary_key: Secondary access key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype secondary_key: str + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationCreateParameters, self).__init__(**kwargs) self.principal_id = principal_id self.primary_key = primary_key @@ -175,18 +205,18 @@ def __init__( class AccessInformationSecretsContract(msrest.serialization.Model): """Tenant access information contract of the API Management service. - :param id: Access Information type ('access' or 'gitAccess'). - :type id: str - :param principal_id: Principal (User) Identifier. - :type principal_id: str - :param primary_key: Primary access key. This property will not be filled on 'GET' operations! + :ivar id: Access Information type ('access' or 'gitAccess'). + :vartype id: str + :ivar principal_id: Principal (User) Identifier. + :vartype principal_id: str + :ivar primary_key: Primary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type primary_key: str - :param secondary_key: Secondary access key. This property will not be filled on 'GET' + :vartype primary_key: str + :ivar secondary_key: Secondary access key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type secondary_key: str - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :vartype secondary_key: str + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -207,6 +237,20 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword id: Access Information type ('access' or 'gitAccess'). + :paramtype id: str + :keyword principal_id: Principal (User) Identifier. + :paramtype principal_id: str + :keyword primary_key: Primary access key. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype primary_key: str + :keyword secondary_key: Secondary access key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype secondary_key: str + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationSecretsContract, self).__init__(**kwargs) self.id = id self.principal_id = principal_id @@ -218,8 +262,8 @@ def __init__( class AccessInformationUpdateParameters(msrest.serialization.Model): """Tenant access information update parameters. - :param enabled: Determines whether direct access is enabled. - :type enabled: bool + :ivar enabled: Determines whether direct access is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -232,6 +276,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Determines whether direct access is enabled. + :paramtype enabled: bool + """ super(AccessInformationUpdateParameters, self).__init__(**kwargs) self.enabled = enabled @@ -243,13 +291,13 @@ class AdditionalLocation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The location name of the additional region among Azure Data center + :ivar location: Required. The location name of the additional region among Azure Data center regions. - :type location: str - :param sku: Required. SKU properties of the API Management service. - :type sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] + :vartype location: str + :ivar sku: Required. SKU properties of the API Management service. + :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in the additional location. Available only for Basic, Standard, Premium and Isolated SKU. @@ -258,14 +306,21 @@ class AdditionalLocation(msrest.serialization.Model): service which is deployed in an Internal Virtual Network in a particular additional location. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration for the location. - :type virtual_network_configuration: + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the location. Supported only for Premium SKU being deployed + in Virtual Network. + :vartype public_ip_address_id: str + :ivar virtual_network_configuration: Virtual network configuration for the location. + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration :ivar gateway_regional_url: Gateway URL of the API Management service in the Region. :vartype gateway_regional_url: str - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in this additional location. - :type disable_gateway: bool + :vartype disable_gateway: bool + :ivar platform_version: Compute Platform Version running the service. Possible values include: + "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion """ _validation = { @@ -274,6 +329,7 @@ class AdditionalLocation(msrest.serialization.Model): 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, 'gateway_regional_url': {'readonly': True}, + 'platform_version': {'readonly': True}, } _attribute_map = { @@ -282,9 +338,11 @@ class AdditionalLocation(msrest.serialization.Model): 'zones': {'key': 'zones', 'type': '[str]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'gateway_regional_url': {'key': 'gatewayRegionalUrl', 'type': 'str'}, 'disable_gateway': {'key': 'disableGateway', 'type': 'bool'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, } def __init__( @@ -293,30 +351,52 @@ def __init__( location: str, sku: "ApiManagementServiceSkuProperties", zones: Optional[List[str]] = None, + public_ip_address_id: Optional[str] = None, virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, disable_gateway: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. The location name of the additional region among Azure Data center + regions. + :paramtype location: str + :keyword sku: Required. SKU properties of the API Management service. + :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the location. Supported only for Premium SKU being deployed + in Virtual Network. + :paramtype public_ip_address_id: str + :keyword virtual_network_configuration: Virtual network configuration for the location. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in this additional location. + :paramtype disable_gateway: bool + """ super(AdditionalLocation, self).__init__(**kwargs) self.location = location self.sku = sku self.zones = zones self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = public_ip_address_id self.virtual_network_configuration = virtual_network_configuration self.gateway_regional_url = None self.disable_gateway = disable_gateway + self.platform_version = None class ApiCollection(msrest.serialization.Model): - """Paged Api list representation. + """Paged API list representation. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.ApiContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -338,65 +418,120 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(ApiCollection, self).__init__(**kwargs) self.value = None self.count = count self.next_link = None +class ApiContactInformation(msrest.serialization.Model): + """API contact information. + + :ivar name: The identifying name of the contact person/organization. + :vartype name: str + :ivar url: The URL pointing to the contact information. MUST be in the format of a URL. + :vartype url: str + :ivar email: The email address of the contact person/organization. MUST be in the format of an + email address. + :vartype email: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + url: Optional[str] = None, + email: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The identifying name of the contact person/organization. + :paramtype name: str + :keyword url: The URL pointing to the contact information. MUST be in the format of a URL. + :paramtype url: str + :keyword email: The email address of the contact person/organization. MUST be in the format of + an email address. + :paramtype email: str + """ + super(ApiContactInformation, self).__init__(**kwargs) + self.name = name + self.url = url + self.email = email + + class ApiContract(Resource): - """Api details. + """API details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails """ _validation = { @@ -429,6 +564,9 @@ class ApiContract(Resource): 'api_version_description': {'key': 'properties.apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'properties.apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'properties.subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'properties.termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'properties.contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'properties.license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'properties.sourceApiId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, @@ -451,6 +589,9 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, source_api_id: Optional[str] = None, display_name: Optional[str] = None, service_url: Optional[str] = None, @@ -459,6 +600,57 @@ def __init__( api_version_set: Optional["ApiVersionSetContractDetails"] = None, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + """ super(ApiContract, self).__init__(**kwargs) self.description = description self.authentication_settings = authentication_settings @@ -472,6 +664,9 @@ def __init__( self.api_version_description = api_version_description self.api_version_set_id = api_version_set_id self.subscription_required = subscription_required + self.terms_of_service_url = terms_of_service_url + self.contact = contact + self.license = license self.source_api_id = source_api_id self.display_name = display_name self.service_url = service_url @@ -485,33 +680,41 @@ class ApiEntityBaseContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation """ _validation = { @@ -535,6 +738,9 @@ class ApiEntityBaseContract(msrest.serialization.Model): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, } def __init__( @@ -551,8 +757,47 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, - **kwargs - ): + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, + **kwargs + ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + """ super(ApiEntityBaseContract, self).__init__(**kwargs) self.description = description self.authentication_settings = authentication_settings @@ -566,57 +811,68 @@ def __init__( self.api_version_description = api_version_description self.api_version_set_id = api_version_set_id self.subscription_required = subscription_required + self.terms_of_service_url = terms_of_service_url + self.contact = contact + self.license = license class ApiContractProperties(ApiEntityBaseContract): - """Api Entity Properties. + """API Entity Properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Required. Relative URL uniquely identifying this API and all of its resource paths + :vartype service_url: str + :ivar path: Required. Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails """ _validation = { @@ -643,6 +899,9 @@ class ApiContractProperties(ApiEntityBaseContract): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'sourceApiId', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, @@ -666,6 +925,9 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, source_api_id: Optional[str] = None, display_name: Optional[str] = None, service_url: Optional[str] = None, @@ -673,7 +935,58 @@ def __init__( api_version_set: Optional["ApiVersionSetContractDetails"] = None, **kwargs ): - super(ApiContractProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, **kwargs) + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Required. Relative URL uniquely identifying this API and all of its resource + paths within the API Management service instance. It is appended to the API endpoint base URL + specified during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + """ + super(ApiContractProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, terms_of_service_url=terms_of_service_url, contact=contact, license=license, **kwargs) self.source_api_id = source_api_id self.display_name = display_name self.service_url = service_url @@ -687,43 +1000,51 @@ class ApiContractUpdateProperties(ApiEntityBaseContract): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param display_name: API name. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar display_name: API name. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] """ _validation = { @@ -750,6 +1071,9 @@ class ApiContractUpdateProperties(ApiEntityBaseContract): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, 'path': {'key': 'path', 'type': 'str'}, @@ -770,13 +1094,62 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, display_name: Optional[str] = None, service_url: Optional[str] = None, path: Optional[str] = None, protocols: Optional[List[Union[str, "Protocol"]]] = None, **kwargs ): - super(ApiContractUpdateProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, **kwargs) + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword display_name: API name. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + """ + super(ApiContractUpdateProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, terms_of_service_url=terms_of_service_url, contact=contact, license=license, **kwargs) self.display_name = display_name self.service_url = service_url self.path = path @@ -788,62 +1161,74 @@ class ApiCreateOrUpdateParameter(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails - :param value: Content value when Importing an API. - :type value: str - :param format: Format of the Content in which the API is getting imported. Possible values + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :ivar value: Content value when Importing an API. + :vartype value: str + :ivar format: Format of the Content in which the API is getting imported. Possible values include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", - "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link". - :type format: str or ~azure.mgmt.apimanagement.models.ContentFormat - :param wsdl_selector: Criteria to limit import of WSDL to a subset of the document. - :type wsdl_selector: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector - :param soap_api_type: Type of Api to create. + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :vartype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :ivar wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :vartype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :ivar soap_api_type: Type of API to create. - * ``http`` creates a SOAP to REST API - * ``soap`` creates a SOAP pass-through API . Possible values include: "http", "soap". - :type soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType """ _validation = { @@ -870,6 +1255,9 @@ class ApiCreateOrUpdateParameter(msrest.serialization.Model): 'api_version_description': {'key': 'properties.apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'properties.apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'properties.subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'properties.termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'properties.contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'properties.license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'properties.sourceApiId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, @@ -896,6 +1284,9 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, source_api_id: Optional[str] = None, display_name: Optional[str] = None, service_url: Optional[str] = None, @@ -908,6 +1299,75 @@ def __init__( soap_api_type: Optional[Union[str, "SoapApiType"]] = None, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :keyword value: Content value when Importing an API. + :paramtype value: str + :keyword format: Format of the Content in which the API is getting imported. Possible values + include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :paramtype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :keyword wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :paramtype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :keyword soap_api_type: Type of API to create. + + + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + """ super(ApiCreateOrUpdateParameter, self).__init__(**kwargs) self.description = description self.authentication_settings = authentication_settings @@ -921,6 +1381,9 @@ def __init__( self.api_version_description = api_version_description self.api_version_set_id = api_version_set_id self.subscription_required = subscription_required + self.terms_of_service_url = terms_of_service_url + self.contact = contact + self.license = license self.source_api_id = source_api_id self.display_name = display_name self.service_url = service_url @@ -934,68 +1397,80 @@ def __init__( class ApiCreateOrUpdateProperties(ApiContractProperties): - """Api Create or Update Properties. + """API Create or Update Properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param source_api_id: API identifier of the source API. - :type source_api_id: str - :param display_name: API name. Must be 1 to 300 characters long. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. Cannot be more + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar source_api_id: API identifier of the source API. + :vartype source_api_id: str + :ivar display_name: API name. Must be 1 to 300 characters long. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long. - :type service_url: str - :param path: Required. Relative URL uniquely identifying this API and all of its resource paths + :vartype service_url: str + :ivar path: Required. Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails - :param value: Content value when Importing an API. - :type value: str - :param format: Format of the Content in which the API is getting imported. Possible values + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :ivar value: Content value when Importing an API. + :vartype value: str + :ivar format: Format of the Content in which the API is getting imported. Possible values include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", - "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link". - :type format: str or ~azure.mgmt.apimanagement.models.ContentFormat - :param wsdl_selector: Criteria to limit import of WSDL to a subset of the document. - :type wsdl_selector: ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector - :param soap_api_type: Type of Api to create. + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :vartype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :ivar wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :vartype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :ivar soap_api_type: Type of API to create. - * ``http`` creates a SOAP to REST API - * ``soap`` creates a SOAP pass-through API . Possible values include: "http", "soap". - :type soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :vartype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType """ _validation = { @@ -1022,6 +1497,9 @@ class ApiCreateOrUpdateProperties(ApiContractProperties): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'source_api_id': {'key': 'sourceApiId', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, @@ -1049,6 +1527,9 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, source_api_id: Optional[str] = None, display_name: Optional[str] = None, service_url: Optional[str] = None, @@ -1060,7 +1541,76 @@ def __init__( soap_api_type: Optional[Union[str, "SoapApiType"]] = None, **kwargs ): - super(ApiCreateOrUpdateProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, source_api_id=source_api_id, display_name=display_name, service_url=service_url, path=path, protocols=protocols, api_version_set=api_version_set, **kwargs) + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword source_api_id: API identifier of the source API. + :paramtype source_api_id: str + :keyword display_name: API name. Must be 1 to 300 characters long. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. Cannot be more + than 2000 characters long. + :paramtype service_url: str + :keyword path: Required. Relative URL uniquely identifying this API and all of its resource + paths within the API Management service instance. It is appended to the API endpoint base URL + specified during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :keyword value: Content value when Importing an API. + :paramtype value: str + :keyword format: Format of the Content in which the API is getting imported. Possible values + include: "wadl-xml", "wadl-link-json", "swagger-json", "swagger-link-json", "wsdl", + "wsdl-link", "openapi", "openapi+json", "openapi-link", "openapi+json-link", "graphql-link". + :paramtype format: str or ~azure.mgmt.apimanagement.models.ContentFormat + :keyword wsdl_selector: Criteria to limit import of WSDL to a subset of the document. + :paramtype wsdl_selector: + ~azure.mgmt.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector + :keyword soap_api_type: Type of API to create. + + + * ``http`` creates a REST API + * ``soap`` creates a SOAP pass-through API + * ``websocket`` creates websocket API + * ``graphql`` creates GraphQL API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype soap_api_type: str or ~azure.mgmt.apimanagement.models.SoapApiType + """ + super(ApiCreateOrUpdateProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, terms_of_service_url=terms_of_service_url, contact=contact, license=license, source_api_id=source_api_id, display_name=display_name, service_url=service_url, path=path, protocols=protocols, api_version_set=api_version_set, **kwargs) self.value = value self.format = format self.wsdl_selector = wsdl_selector @@ -1070,10 +1620,10 @@ def __init__( class ApiCreateOrUpdatePropertiesWsdlSelector(msrest.serialization.Model): """Criteria to limit import of WSDL to a subset of the document. - :param wsdl_service_name: Name of service to import from WSDL. - :type wsdl_service_name: str - :param wsdl_endpoint_name: Name of endpoint(port) to import from WSDL. - :type wsdl_endpoint_name: str + :ivar wsdl_service_name: Name of service to import from WSDL. + :vartype wsdl_service_name: str + :ivar wsdl_endpoint_name: Name of endpoint(port) to import from WSDL. + :vartype wsdl_endpoint_name: str """ _attribute_map = { @@ -1088,6 +1638,12 @@ def __init__( wsdl_endpoint_name: Optional[str] = None, **kwargs ): + """ + :keyword wsdl_service_name: Name of service to import from WSDL. + :paramtype wsdl_service_name: str + :keyword wsdl_endpoint_name: Name of endpoint(port) to import from WSDL. + :paramtype wsdl_endpoint_name: str + """ super(ApiCreateOrUpdatePropertiesWsdlSelector, self).__init__(**kwargs) self.wsdl_service_name = wsdl_service_name self.wsdl_endpoint_name = wsdl_endpoint_name @@ -1096,14 +1652,14 @@ def __init__( class ApiExportResult(msrest.serialization.Model): """API Export result. - :param id: ResourceId of the API which was exported. - :type id: str - :param export_result_format: Format in which the Api Details are exported to the Storage Blob + :ivar id: ResourceId of the API which was exported. + :vartype id: str + :ivar export_result_format: Format in which the API Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: "swagger-link-json", "wsdl-link+xml", "wadl-link-json", "openapi-link". - :type export_result_format: str or ~azure.mgmt.apimanagement.models.ExportResultFormat - :param value: The object defining the schema of the exported Api Detail. - :type value: ~azure.mgmt.apimanagement.models.ApiExportResultValue + :vartype export_result_format: str or ~azure.mgmt.apimanagement.models.ExportResultFormat + :ivar value: The object defining the schema of the exported API Detail. + :vartype value: ~azure.mgmt.apimanagement.models.ApiExportResultValue """ _attribute_map = { @@ -1120,6 +1676,16 @@ def __init__( value: Optional["ApiExportResultValue"] = None, **kwargs ): + """ + :keyword id: ResourceId of the API which was exported. + :paramtype id: str + :keyword export_result_format: Format in which the API Details are exported to the Storage Blob + with Sas Key valid for 5 minutes. Possible values include: "swagger-link-json", + "wsdl-link+xml", "wadl-link-json", "openapi-link". + :paramtype export_result_format: str or ~azure.mgmt.apimanagement.models.ExportResultFormat + :keyword value: The object defining the schema of the exported API Detail. + :paramtype value: ~azure.mgmt.apimanagement.models.ApiExportResultValue + """ super(ApiExportResult, self).__init__(**kwargs) self.id = id self.export_result_format = export_result_format @@ -1127,11 +1693,11 @@ def __init__( class ApiExportResultValue(msrest.serialization.Model): - """The object defining the schema of the exported Api Detail. + """The object defining the schema of the exported API Detail. - :param link: Link to the Storage Blob containing the result of the export operation. The Blob + :ivar link: Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes. - :type link: str + :vartype link: str """ _attribute_map = { @@ -1144,16 +1710,53 @@ def __init__( link: Optional[str] = None, **kwargs ): + """ + :keyword link: Link to the Storage Blob containing the result of the export operation. The Blob + Uri is only valid for 5 minutes. + :paramtype link: str + """ super(ApiExportResultValue, self).__init__(**kwargs) self.link = link +class ApiLicenseInformation(msrest.serialization.Model): + """API license information. + + :ivar name: The license name used for the API. + :vartype name: str + :ivar url: A URL to the license used for the API. MUST be in the format of a URL. + :vartype url: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + url: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The license name used for the API. + :paramtype name: str + :keyword url: A URL to the license used for the API. MUST be in the format of a URL. + :paramtype url: str + """ + super(ApiLicenseInformation, self).__init__(**kwargs) + self.name = name + self.url = url + + class ApiManagementServiceApplyNetworkConfigurationParameters(msrest.serialization.Model): """Parameter supplied to the Apply Network configuration operation. - :param location: Location of the Api Management service to update for a multi-region service. + :ivar location: Location of the Api Management service to update for a multi-region service. For a service deployed in a single region, this parameter is not required. - :type location: str + :vartype location: str """ _attribute_map = { @@ -1166,6 +1769,11 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Location of the Api Management service to update for a multi-region service. + For a service deployed in a single region, this parameter is not required. + :paramtype location: str + """ super(ApiManagementServiceApplyNetworkConfigurationParameters, self).__init__(**kwargs) self.location = location @@ -1175,47 +1783,79 @@ class ApiManagementServiceBackupRestoreParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account: Required. Azure Cloud Storage account (used to place/retrieve the - backup) name. - :type storage_account: str - :param access_key: Required. Azure Cloud Storage account (used to place/retrieve the backup) - access key. - :type access_key: str - :param container_name: Required. Azure Cloud Storage blob container name used to place/retrieve - the backup. - :type container_name: str - :param backup_name: Required. The name of the backup file to create. - :type backup_name: str + :ivar storage_account: Required. The name of the Azure storage account (used to place/retrieve + the backup). + :vartype storage_account: str + :ivar container_name: Required. The name of the blob container (used to place/retrieve the + backup). + :vartype container_name: str + :ivar backup_name: Required. The name of the backup file to create/retrieve. + :vartype backup_name: str + :ivar access_type: The type of access to be used for the storage account. Possible values + include: "AccessKey", "SystemAssignedManagedIdentity", "UserAssignedManagedIdentity". Default + value: "AccessKey". + :vartype access_type: str or ~azure.mgmt.apimanagement.models.AccessType + :ivar access_key: Storage account access key. Required only if ``accessType`` is set to + ``AccessKey``. + :vartype access_key: str + :ivar client_id: The Client ID of user assigned managed identity. Required only if + ``accessType`` is set to ``UserAssignedManagedIdentity``. + :vartype client_id: str """ _validation = { 'storage_account': {'required': True}, - 'access_key': {'required': True}, 'container_name': {'required': True}, 'backup_name': {'required': True}, } _attribute_map = { 'storage_account': {'key': 'storageAccount', 'type': 'str'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, 'container_name': {'key': 'containerName', 'type': 'str'}, 'backup_name': {'key': 'backupName', 'type': 'str'}, + 'access_type': {'key': 'accessType', 'type': 'str'}, + 'access_key': {'key': 'accessKey', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, } def __init__( self, *, storage_account: str, - access_key: str, container_name: str, backup_name: str, + access_type: Optional[Union[str, "AccessType"]] = "AccessKey", + access_key: Optional[str] = None, + client_id: Optional[str] = None, **kwargs ): + """ + :keyword storage_account: Required. The name of the Azure storage account (used to + place/retrieve the backup). + :paramtype storage_account: str + :keyword container_name: Required. The name of the blob container (used to place/retrieve the + backup). + :paramtype container_name: str + :keyword backup_name: Required. The name of the backup file to create/retrieve. + :paramtype backup_name: str + :keyword access_type: The type of access to be used for the storage account. Possible values + include: "AccessKey", "SystemAssignedManagedIdentity", "UserAssignedManagedIdentity". Default + value: "AccessKey". + :paramtype access_type: str or ~azure.mgmt.apimanagement.models.AccessType + :keyword access_key: Storage account access key. Required only if ``accessType`` is set to + ``AccessKey``. + :paramtype access_key: str + :keyword client_id: The Client ID of user assigned managed identity. Required only if + ``accessType`` is set to ``UserAssignedManagedIdentity``. + :paramtype client_id: str + """ super(ApiManagementServiceBackupRestoreParameters, self).__init__(**kwargs) self.storage_account = storage_account - self.access_key = access_key self.container_name = container_name self.backup_name = backup_name + self.access_type = access_type + self.access_key = access_key + self.client_id = client_id class ApiManagementServiceBaseProperties(msrest.serialization.Model): @@ -1223,8 +1863,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1247,8 +1887,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1256,13 +1896,22 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1289,30 +1938,36 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion """ _validation = { @@ -1328,6 +1983,7 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, } _attribute_map = { @@ -1344,6 +2000,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): 'hostname_configurations': {'key': 'hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, @@ -1353,6 +2011,8 @@ class ApiManagementServiceBaseProperties(msrest.serialization.Model): 'virtual_network_type': {'key': 'virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, } def __init__( @@ -1360,6 +2020,8 @@ def __init__( *, notification_sender_email: Optional[str] = None, hostname_configurations: Optional[List["HostnameConfiguration"]] = None, + public_ip_address_id: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, additional_locations: Optional[List["AdditionalLocation"]] = None, custom_properties: Optional[Dict[str, str]] = None, @@ -1369,8 +2031,85 @@ def __init__( virtual_network_type: Optional[Union[str, "VirtualNetworkType"]] = "None", api_version_constraint: Optional["ApiVersionConstraint"] = None, restore: Optional[bool] = False, - **kwargs - ): + private_endpoint_connections: Optional[List["RemotePrivateEndpointConnectionWrapper"]] = None, + **kwargs + ): + """ + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + """ super(ApiManagementServiceBaseProperties, self).__init__(**kwargs) self.notification_sender_email = notification_sender_email self.provisioning_state = None @@ -1385,6 +2124,8 @@ def __init__( self.hostname_configurations = hostname_configurations self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = public_ip_address_id + self.public_network_access = public_network_access self.virtual_network_configuration = virtual_network_configuration self.additional_locations = additional_locations self.custom_properties = custom_properties @@ -1394,6 +2135,8 @@ def __init__( self.virtual_network_type = virtual_network_type self.api_version_constraint = api_version_constraint self.restore = restore + self.private_endpoint_connections = private_endpoint_connections + self.platform_version = None class ApiManagementServiceCheckNameAvailabilityParameters(msrest.serialization.Model): @@ -1401,8 +2144,8 @@ class ApiManagementServiceCheckNameAvailabilityParameters(msrest.serialization.M All required parameters must be populated in order to send to Azure. - :param name: Required. The name to check for availability. - :type name: str + :ivar name: Required. The name to check for availability. + :vartype name: str """ _validation = { @@ -1419,6 +2162,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The name to check for availability. + :paramtype name: str + """ super(ApiManagementServiceCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1444,6 +2191,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementServiceGetDomainOwnershipIdentifierResult, self).__init__(**kwargs) self.domain_ownership_identifier = None @@ -1451,8 +2200,8 @@ def __init__( class ApiManagementServiceGetSsoTokenResult(msrest.serialization.Model): """The response of the GetSsoToken operation. - :param redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. - :type redirect_uri: str + :ivar redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. + :vartype redirect_uri: str """ _attribute_map = { @@ -1465,6 +2214,10 @@ def __init__( redirect_uri: Optional[str] = None, **kwargs ): + """ + :keyword redirect_uri: Redirect URL to the Publisher Portal containing the SSO token. + :paramtype redirect_uri: str + """ super(ApiManagementServiceGetSsoTokenResult, self).__init__(**kwargs) self.redirect_uri = redirect_uri @@ -1476,21 +2229,21 @@ class ApiManagementServiceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of identity used for the resource. The type 'SystemAssigned, + :ivar type: Required. The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.apimanagement.models.ApimIdentityType + :vartype type: str or ~azure.mgmt.apimanagement.models.ApimIdentityType :ivar principal_id: The principal id of the identity. :vartype principal_id: str :ivar tenant_id: The client tenant id of the identity. :vartype tenant_id: str - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.apimanagement.models.UserIdentityProperties] """ @@ -1514,6 +2267,20 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentityProperties"]] = None, **kwargs ): + """ + :keyword type: Required. The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the service. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.apimanagement.models.ApimIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity + dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.apimanagement.models.UserIdentityProperties] + """ super(ApiManagementServiceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -1526,11 +2293,11 @@ class ApiManagementServiceListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. Result of the List API Management services operation. - :type value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :param next_link: Link to the next set of results. Not empty if Value contains incomplete list + :ivar value: Required. Result of the List API Management services operation. + :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :ivar next_link: Link to the next set of results. Not empty if Value contains incomplete list of API Management services. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1549,6 +2316,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. Result of the List API Management services operation. + :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :keyword next_link: Link to the next set of results. Not empty if Value contains incomplete + list of API Management services. + :paramtype next_link: str + """ super(ApiManagementServiceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1567,11 +2341,11 @@ class ApiManagementServiceNameAvailabilityResult(msrest.serialization.Model): If reason == AlreadyExists, explain that :code:`` is already in use, and direct them to select a different name. :vartype message: str - :param reason: Invalid indicates the name provided does not match the resource provider’s - naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates - that the name is already in use and is therefore unavailable. Possible values include: "Valid", + :ivar reason: Invalid indicates the name provided does not match the resource provider’s naming + requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates that the + name is already in use and is therefore unavailable. Possible values include: "Valid", "Invalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.apimanagement.models.NameAvailabilityReason + :vartype reason: str or ~azure.mgmt.apimanagement.models.NameAvailabilityReason """ _validation = { @@ -1591,6 +2365,13 @@ def __init__( reason: Optional[Union[str, "NameAvailabilityReason"]] = None, **kwargs ): + """ + :keyword reason: Invalid indicates the name provided does not match the resource provider’s + naming requirements (incorrect length, unsupported characters, etc.) AlreadyExists indicates + that the name is already in use and is therefore unavailable. Possible values include: "Valid", + "Invalid", "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.apimanagement.models.NameAvailabilityReason + """ super(ApiManagementServiceNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.message = None @@ -1604,8 +2385,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): All required parameters must be populated in order to send to Azure. - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1628,8 +2409,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1637,13 +2418,22 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1670,34 +2460,40 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Required. Publisher email. - :type publisher_email: str - :param publisher_name: Required. Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Required. Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Required. Publisher name. + :vartype publisher_name: str """ _validation = { @@ -1713,6 +2509,7 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'required': True, 'max_length': 100, 'min_length': 0}, 'publisher_name': {'required': True, 'max_length': 100, 'min_length': 0}, } @@ -1731,6 +2528,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): 'hostname_configurations': {'key': 'hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, @@ -1740,6 +2539,8 @@ class ApiManagementServiceProperties(ApiManagementServiceBaseProperties): 'virtual_network_type': {'key': 'virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'publisherName', 'type': 'str'}, } @@ -1751,6 +2552,8 @@ def __init__( publisher_name: str, notification_sender_email: Optional[str] = None, hostname_configurations: Optional[List["HostnameConfiguration"]] = None, + public_ip_address_id: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, additional_locations: Optional[List["AdditionalLocation"]] = None, custom_properties: Optional[Dict[str, str]] = None, @@ -1760,9 +2563,90 @@ def __init__( virtual_network_type: Optional[Union[str, "VirtualNetworkType"]] = "None", api_version_constraint: Optional["ApiVersionConstraint"] = None, restore: Optional[bool] = False, - **kwargs - ): - super(ApiManagementServiceProperties, self).__init__(notification_sender_email=notification_sender_email, hostname_configurations=hostname_configurations, virtual_network_configuration=virtual_network_configuration, additional_locations=additional_locations, custom_properties=custom_properties, certificates=certificates, enable_client_certificate=enable_client_certificate, disable_gateway=disable_gateway, virtual_network_type=virtual_network_type, api_version_constraint=api_version_constraint, restore=restore, **kwargs) + private_endpoint_connections: Optional[List["RemotePrivateEndpointConnectionWrapper"]] = None, + **kwargs + ): + """ + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Required. Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Required. Publisher name. + :paramtype publisher_name: str + """ + super(ApiManagementServiceProperties, self).__init__(notification_sender_email=notification_sender_email, hostname_configurations=hostname_configurations, public_ip_address_id=public_ip_address_id, public_network_access=public_network_access, virtual_network_configuration=virtual_network_configuration, additional_locations=additional_locations, custom_properties=custom_properties, certificates=certificates, enable_client_certificate=enable_client_certificate, disable_gateway=disable_gateway, virtual_network_type=virtual_network_type, api_version_constraint=api_version_constraint, restore=restore, private_endpoint_connections=private_endpoint_connections, **kwargs) self.publisher_email = publisher_email self.publisher_name = publisher_name @@ -1778,8 +2662,8 @@ class ApimResource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -1801,6 +2685,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ApimResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1821,20 +2709,22 @@ class ApiManagementServiceResource(ApimResource): :vartype name: str :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: Required. SKU properties of the API Management service. - :type sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties - :param identity: Managed service identity of the Api Management service. - :type identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity - :param location: Required. Resource location. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Required. SKU properties of the API Management service. + :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :ivar identity: Managed service identity of the Api Management service. + :vartype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.apimanagement.models.SystemData + :ivar location: Required. Resource location. + :vartype location: str :ivar etag: ETag of the resource. :vartype etag: str - :param zones: A list of availability zones denoting where the resource needs to come from. - :type zones: list[str] - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -1857,8 +2747,8 @@ class ApiManagementServiceResource(ApimResource): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -1866,13 +2756,22 @@ class ApiManagementServiceResource(ApimResource): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -1899,34 +2798,40 @@ class ApiManagementServiceResource(ApimResource): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Required. Publisher email. - :type publisher_email: str - :param publisher_name: Required. Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Required. Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Required. Publisher name. + :vartype publisher_name: str """ _validation = { @@ -1934,6 +2839,7 @@ class ApiManagementServiceResource(ApimResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'sku': {'required': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, 'etag': {'readonly': True}, 'notification_sender_email': {'max_length': 100, 'min_length': 0}, @@ -1948,6 +2854,7 @@ class ApiManagementServiceResource(ApimResource): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'required': True, 'max_length': 100, 'min_length': 0}, 'publisher_name': {'required': True, 'max_length': 100, 'min_length': 0}, } @@ -1959,6 +2866,7 @@ class ApiManagementServiceResource(ApimResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'ApiManagementServiceSkuProperties'}, 'identity': {'key': 'identity', 'type': 'ApiManagementServiceIdentity'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'location': {'key': 'location', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'zones': {'key': 'zones', 'type': '[str]'}, @@ -1975,6 +2883,8 @@ class ApiManagementServiceResource(ApimResource): 'hostname_configurations': {'key': 'properties.hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'properties.publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'properties.privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'properties.publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'properties.additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'properties.customProperties', 'type': '{str}'}, @@ -1984,6 +2894,8 @@ class ApiManagementServiceResource(ApimResource): 'virtual_network_type': {'key': 'properties.virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'properties.apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'properties.restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'properties.platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'properties.publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, } @@ -2000,6 +2912,8 @@ def __init__( zones: Optional[List[str]] = None, notification_sender_email: Optional[str] = None, hostname_configurations: Optional[List["HostnameConfiguration"]] = None, + public_ip_address_id: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, additional_locations: Optional[List["AdditionalLocation"]] = None, custom_properties: Optional[Dict[str, str]] = None, @@ -2009,11 +2923,103 @@ def __init__( virtual_network_type: Optional[Union[str, "VirtualNetworkType"]] = "None", api_version_constraint: Optional["ApiVersionConstraint"] = None, restore: Optional[bool] = False, - **kwargs - ): + private_endpoint_connections: Optional[List["RemotePrivateEndpointConnectionWrapper"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Required. SKU properties of the API Management service. + :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :keyword identity: Managed service identity of the Api Management service. + :paramtype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :keyword location: Required. Resource location. + :paramtype location: str + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Required. Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Required. Publisher name. + :paramtype publisher_name: str + """ super(ApiManagementServiceResource, self).__init__(tags=tags, **kwargs) self.sku = sku self.identity = identity + self.system_data = None self.location = location self.etag = None self.zones = zones @@ -2030,6 +3036,8 @@ def __init__( self.hostname_configurations = hostname_configurations self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = public_ip_address_id + self.public_network_access = public_network_access self.virtual_network_configuration = virtual_network_configuration self.additional_locations = additional_locations self.custom_properties = custom_properties @@ -2039,6 +3047,8 @@ def __init__( self.virtual_network_type = virtual_network_type self.api_version_constraint = api_version_constraint self.restore = restore + self.private_endpoint_connections = private_endpoint_connections + self.platform_version = None self.publisher_email = publisher_email self.publisher_name = publisher_name @@ -2048,12 +3058,12 @@ class ApiManagementServiceSkuProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the Sku. Possible values include: "Developer", "Standard", + :ivar name: Required. Name of the Sku. Possible values include: "Developer", "Standard", "Premium", "Basic", "Consumption", "Isolated". - :type name: str or ~azure.mgmt.apimanagement.models.SkuType - :param capacity: Required. Capacity of the SKU (number of deployed units of the SKU). For + :vartype name: str or ~azure.mgmt.apimanagement.models.SkuType + :ivar capacity: Required. Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU capacity must be specified as 0. - :type capacity: int + :vartype capacity: int """ _validation = { @@ -2073,6 +3083,14 @@ def __init__( capacity: int, **kwargs ): + """ + :keyword name: Required. Name of the Sku. Possible values include: "Developer", "Standard", + "Premium", "Basic", "Consumption", "Isolated". + :paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType + :keyword capacity: Required. Capacity of the SKU (number of deployed units of the SKU). For + Consumption SKU capacity must be specified as 0. + :paramtype capacity: int + """ super(ApiManagementServiceSkuProperties, self).__init__(**kwargs) self.name = name self.capacity = capacity @@ -2089,16 +3107,18 @@ class ApiManagementServiceUpdateParameters(ApimResource): :vartype name: str :ivar type: Resource type for API Management resource is set to Microsoft.ApiManagement. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: SKU properties of the API Management service. - :type sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties - :param identity: Managed service identity of the Api Management service. - :type identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: SKU properties of the API Management service. + :vartype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :ivar identity: Managed service identity of the Api Management service. + :vartype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity :ivar etag: ETag of the resource. :vartype etag: str - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar zones: A list of availability zones denoting where the resource needs to come from. + :vartype zones: list[str] + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -2121,8 +3141,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -2130,13 +3150,22 @@ class ApiManagementServiceUpdateParameters(ApimResource): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -2163,34 +3192,40 @@ class ApiManagementServiceUpdateParameters(ApimResource): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Publisher email. - :type publisher_email: str - :param publisher_name: Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Publisher name. + :vartype publisher_name: str """ _validation = { @@ -2210,6 +3245,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'max_length': 100, 'min_length': 0}, 'publisher_name': {'max_length': 100, 'min_length': 0}, } @@ -2222,6 +3258,7 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'sku': {'key': 'sku', 'type': 'ApiManagementServiceSkuProperties'}, 'identity': {'key': 'identity', 'type': 'ApiManagementServiceIdentity'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, 'notification_sender_email': {'key': 'properties.notificationSenderEmail', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'target_provisioning_state': {'key': 'properties.targetProvisioningState', 'type': 'str'}, @@ -2235,6 +3272,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'hostname_configurations': {'key': 'properties.hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'properties.publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'properties.privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'properties.publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'properties.additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'properties.customProperties', 'type': '{str}'}, @@ -2244,6 +3283,8 @@ class ApiManagementServiceUpdateParameters(ApimResource): 'virtual_network_type': {'key': 'properties.virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'properties.apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'properties.restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'properties.platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'properties.publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'properties.publisherName', 'type': 'str'}, } @@ -2254,8 +3295,11 @@ def __init__( tags: Optional[Dict[str, str]] = None, sku: Optional["ApiManagementServiceSkuProperties"] = None, identity: Optional["ApiManagementServiceIdentity"] = None, + zones: Optional[List[str]] = None, notification_sender_email: Optional[str] = None, hostname_configurations: Optional[List["HostnameConfiguration"]] = None, + public_ip_address_id: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, additional_locations: Optional[List["AdditionalLocation"]] = None, custom_properties: Optional[Dict[str, str]] = None, @@ -2265,14 +3309,104 @@ def __init__( virtual_network_type: Optional[Union[str, "VirtualNetworkType"]] = "None", api_version_constraint: Optional["ApiVersionConstraint"] = None, restore: Optional[bool] = False, + private_endpoint_connections: Optional[List["RemotePrivateEndpointConnectionWrapper"]] = None, publisher_email: Optional[str] = None, publisher_name: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: SKU properties of the API Management service. + :paramtype sku: ~azure.mgmt.apimanagement.models.ApiManagementServiceSkuProperties + :keyword identity: Managed service identity of the Api Management service. + :paramtype identity: ~azure.mgmt.apimanagement.models.ApiManagementServiceIdentity + :keyword zones: A list of availability zones denoting where the resource needs to come from. + :paramtype zones: list[str] + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Publisher name. + :paramtype publisher_name: str + """ super(ApiManagementServiceUpdateParameters, self).__init__(tags=tags, **kwargs) self.sku = sku self.identity = identity self.etag = None + self.zones = zones self.notification_sender_email = notification_sender_email self.provisioning_state = None self.target_provisioning_state = None @@ -2286,6 +3420,8 @@ def __init__( self.hostname_configurations = hostname_configurations self.public_ip_addresses = None self.private_ip_addresses = None + self.public_ip_address_id = public_ip_address_id + self.public_network_access = public_network_access self.virtual_network_configuration = virtual_network_configuration self.additional_locations = additional_locations self.custom_properties = custom_properties @@ -2295,6 +3431,8 @@ def __init__( self.virtual_network_type = virtual_network_type self.api_version_constraint = api_version_constraint self.restore = restore + self.private_endpoint_connections = private_endpoint_connections + self.platform_version = None self.publisher_email = publisher_email self.publisher_name = publisher_name @@ -2304,8 +3442,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param notification_sender_email: Email address from which the notification will be sent. - :type notification_sender_email: str + :ivar notification_sender_email: Email address from which the notification will be sent. + :vartype notification_sender_email: str :ivar provisioning_state: The current provisioning state of the API Management service which can be one of the following: Created/Activating/Succeeded/Updating/Failed/Stopped/Terminating/TerminationFailed/Deleted. @@ -2328,8 +3466,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): :vartype scm_url: str :ivar developer_portal_url: DEveloper Portal endpoint URL of the API Management service. :vartype developer_portal_url: str - :param hostname_configurations: Custom hostname configuration of the API Management service. - :type hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :ivar hostname_configurations: Custom hostname configuration of the API Management service. + :vartype hostname_configurations: list[~azure.mgmt.apimanagement.models.HostnameConfiguration] :ivar public_ip_addresses: Public Static Load Balanced IP addresses of the API Management service in Primary region. Available only for Basic, Standard, Premium and Isolated SKU. :vartype public_ip_addresses: list[str] @@ -2337,13 +3475,22 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): service in Primary region which is deployed in an Internal Virtual Network. Available only for Basic, Standard, Premium and Isolated SKU. :vartype private_ip_addresses: list[str] - :param virtual_network_configuration: Virtual network configuration of the API Management + :ivar public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :vartype public_ip_address_id: str + :ivar public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :vartype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :ivar virtual_network_configuration: Virtual network configuration of the API Management service. - :type virtual_network_configuration: + :vartype virtual_network_configuration: ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration - :param additional_locations: Additional datacenter locations of the API Management service. - :type additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] - :param custom_properties: Custom properties of the API Management service.
Setting + :ivar additional_locations: Additional datacenter locations of the API Management service. + :vartype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :ivar custom_properties: Custom properties of the API Management service.
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to @@ -2370,34 +3517,40 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since they are required by Azure CloudService internal components: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. - :type custom_properties: dict[str, str] - :param certificates: List of Certificates that need to be installed in the API Management + :vartype custom_properties: dict[str, str] + :ivar certificates: List of Certificates that need to be installed in the API Management service. Max supported certificates that can be installed is 10. - :type certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] - :param enable_client_certificate: Property only meant to be used for Consumption SKU Service. + :vartype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :ivar enable_client_certificate: Property only meant to be used for Consumption SKU Service. This enforces a client certificate to be presented on each request to the gateway. This also enables the ability to authenticate the certificate in the policy on the gateway. - :type enable_client_certificate: bool - :param disable_gateway: Property only valid for an Api Management service deployed in multiple + :vartype enable_client_certificate: bool + :ivar disable_gateway: Property only valid for an Api Management service deployed in multiple locations. This can be used to disable the gateway in master region. - :type disable_gateway: bool - :param virtual_network_type: The type of VPN in which API Management service needs to be + :vartype disable_gateway: bool + :ivar virtual_network_type: The type of VPN in which API Management service needs to be configured in. None (Default Value) means the API Management service is not part of any Virtual Network, External means the API Management deployment is set up inside a Virtual Network having an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", "External", "Internal". Default value: "None". - :type virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType - :param api_version_constraint: Control Plane Apis version constraint for the API Management + :vartype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :ivar api_version_constraint: Control Plane Apis version constraint for the API Management service. - :type api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint - :param restore: Undelete Api Management Service if it was previously soft-deleted. If this flag + :vartype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :ivar restore: Undelete Api Management Service if it was previously soft-deleted. If this flag is specified and set to True all other properties will be ignored. - :type restore: bool - :param publisher_email: Publisher email. - :type publisher_email: str - :param publisher_name: Publisher name. - :type publisher_name: str + :vartype restore: bool + :ivar private_endpoint_connections: List of Private Endpoint Connections of this service. + :vartype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :ivar platform_version: Compute Platform Version running the service in this location. Possible + values include: "undetermined", "stv1", "stv2", "mtv1". + :vartype platform_version: str or ~azure.mgmt.apimanagement.models.PlatformVersion + :ivar publisher_email: Publisher email. + :vartype publisher_email: str + :ivar publisher_name: Publisher name. + :vartype publisher_name: str """ _validation = { @@ -2413,6 +3566,7 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): 'developer_portal_url': {'readonly': True}, 'public_ip_addresses': {'readonly': True}, 'private_ip_addresses': {'readonly': True}, + 'platform_version': {'readonly': True}, 'publisher_email': {'max_length': 100, 'min_length': 0}, 'publisher_name': {'max_length': 100, 'min_length': 0}, } @@ -2431,6 +3585,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): 'hostname_configurations': {'key': 'hostnameConfigurations', 'type': '[HostnameConfiguration]'}, 'public_ip_addresses': {'key': 'publicIPAddresses', 'type': '[str]'}, 'private_ip_addresses': {'key': 'privateIPAddresses', 'type': '[str]'}, + 'public_ip_address_id': {'key': 'publicIpAddressId', 'type': 'str'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'virtual_network_configuration': {'key': 'virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, 'additional_locations': {'key': 'additionalLocations', 'type': '[AdditionalLocation]'}, 'custom_properties': {'key': 'customProperties', 'type': '{str}'}, @@ -2440,6 +3596,8 @@ class ApiManagementServiceUpdateProperties(ApiManagementServiceBaseProperties): 'virtual_network_type': {'key': 'virtualNetworkType', 'type': 'str'}, 'api_version_constraint': {'key': 'apiVersionConstraint', 'type': 'ApiVersionConstraint'}, 'restore': {'key': 'restore', 'type': 'bool'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[RemotePrivateEndpointConnectionWrapper]'}, + 'platform_version': {'key': 'platformVersion', 'type': 'str'}, 'publisher_email': {'key': 'publisherEmail', 'type': 'str'}, 'publisher_name': {'key': 'publisherName', 'type': 'str'}, } @@ -2449,6 +3607,8 @@ def __init__( *, notification_sender_email: Optional[str] = None, hostname_configurations: Optional[List["HostnameConfiguration"]] = None, + public_ip_address_id: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, additional_locations: Optional[List["AdditionalLocation"]] = None, custom_properties: Optional[Dict[str, str]] = None, @@ -2458,11 +3618,92 @@ def __init__( virtual_network_type: Optional[Union[str, "VirtualNetworkType"]] = "None", api_version_constraint: Optional["ApiVersionConstraint"] = None, restore: Optional[bool] = False, + private_endpoint_connections: Optional[List["RemotePrivateEndpointConnectionWrapper"]] = None, publisher_email: Optional[str] = None, publisher_name: Optional[str] = None, **kwargs ): - super(ApiManagementServiceUpdateProperties, self).__init__(notification_sender_email=notification_sender_email, hostname_configurations=hostname_configurations, virtual_network_configuration=virtual_network_configuration, additional_locations=additional_locations, custom_properties=custom_properties, certificates=certificates, enable_client_certificate=enable_client_certificate, disable_gateway=disable_gateway, virtual_network_type=virtual_network_type, api_version_constraint=api_version_constraint, restore=restore, **kwargs) + """ + :keyword notification_sender_email: Email address from which the notification will be sent. + :paramtype notification_sender_email: str + :keyword hostname_configurations: Custom hostname configuration of the API Management service. + :paramtype hostname_configurations: + list[~azure.mgmt.apimanagement.models.HostnameConfiguration] + :keyword public_ip_address_id: Public Standard SKU IP V4 based IP address to be associated with + Virtual Network deployed service in the region. Supported only for Developer and Premium SKU + being deployed in Virtual Network. + :paramtype public_ip_address_id: str + :keyword public_network_access: Whether or not public endpoint access is allowed for this API + Management service. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If + 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.apimanagement.models.PublicNetworkAccess + :keyword virtual_network_configuration: Virtual network configuration of the API Management + service. + :paramtype virtual_network_configuration: + ~azure.mgmt.apimanagement.models.VirtualNetworkConfiguration + :keyword additional_locations: Additional datacenter locations of the API Management service. + :paramtype additional_locations: list[~azure.mgmt.apimanagement.models.AdditionalLocation] + :keyword custom_properties: Custom properties of the API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168`` will disable the + cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11`` can be used to + disable just TLS 1.1.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10`` can be used to + disable TLS 1.0 on an API Management service.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11`` can be used + to disable just TLS 1.1 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10`` can be used + to disable TLS 1.0 for communications with backends.
Setting + ``Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2`` can be used to enable + HTTP2 protocol on an API Management service.
Not specifying any of these properties on + PATCH operation will reset omitted properties' values to their defaults. For all the settings + except Http2 the default value is ``True`` if the service was created on or before April 1st + 2018 and ``False`` otherwise. Http2 setting's default value is ``False``.

You can + disable any of next ciphers by using settings + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. + For example, + `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:\ + ``false``. The default value is ``true`` for them. Note: next ciphers can't be disabled since + they are required by Azure CloudService internal components: + TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384. + :paramtype custom_properties: dict[str, str] + :keyword certificates: List of Certificates that need to be installed in the API Management + service. Max supported certificates that can be installed is 10. + :paramtype certificates: list[~azure.mgmt.apimanagement.models.CertificateConfiguration] + :keyword enable_client_certificate: Property only meant to be used for Consumption SKU Service. + This enforces a client certificate to be presented on each request to the gateway. This also + enables the ability to authenticate the certificate in the policy on the gateway. + :paramtype enable_client_certificate: bool + :keyword disable_gateway: Property only valid for an Api Management service deployed in + multiple locations. This can be used to disable the gateway in master region. + :paramtype disable_gateway: bool + :keyword virtual_network_type: The type of VPN in which API Management service needs to be + configured in. None (Default Value) means the API Management service is not part of any Virtual + Network, External means the API Management deployment is set up inside a Virtual Network having + an Internet Facing Endpoint, and Internal means that API Management deployment is setup inside + a Virtual Network having an Intranet Facing Endpoint only. Possible values include: "None", + "External", "Internal". Default value: "None". + :paramtype virtual_network_type: str or ~azure.mgmt.apimanagement.models.VirtualNetworkType + :keyword api_version_constraint: Control Plane Apis version constraint for the API Management + service. + :paramtype api_version_constraint: ~azure.mgmt.apimanagement.models.ApiVersionConstraint + :keyword restore: Undelete Api Management Service if it was previously soft-deleted. If this + flag is specified and set to True all other properties will be ignored. + :paramtype restore: bool + :keyword private_endpoint_connections: List of Private Endpoint Connections of this service. + :paramtype private_endpoint_connections: + list[~azure.mgmt.apimanagement.models.RemotePrivateEndpointConnectionWrapper] + :keyword publisher_email: Publisher email. + :paramtype publisher_email: str + :keyword publisher_name: Publisher name. + :paramtype publisher_name: str + """ + super(ApiManagementServiceUpdateProperties, self).__init__(notification_sender_email=notification_sender_email, hostname_configurations=hostname_configurations, public_ip_address_id=public_ip_address_id, public_network_access=public_network_access, virtual_network_configuration=virtual_network_configuration, additional_locations=additional_locations, custom_properties=custom_properties, certificates=certificates, enable_client_certificate=enable_client_certificate, disable_gateway=disable_gateway, virtual_network_type=virtual_network_type, api_version_constraint=api_version_constraint, restore=restore, private_endpoint_connections=private_endpoint_connections, **kwargs) self.publisher_email = publisher_email self.publisher_name = publisher_name @@ -2540,6 +3781,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSku, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -2581,6 +3824,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuCapabilities, self).__init__(**kwargs) self.name = None self.value = None @@ -2620,6 +3865,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -2656,6 +3903,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuCosts, self).__init__(**kwargs) self.meter_id = None self.quantity = None @@ -2691,6 +3940,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuLocationInfo, self).__init__(**kwargs) self.location = None self.zones = None @@ -2722,6 +3973,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuRestrictionInfo, self).__init__(**kwargs) self.locations = None self.zones = None @@ -2763,6 +4016,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuRestrictions, self).__init__(**kwargs) self.type = None self.values = None @@ -2777,8 +4032,8 @@ class ApiManagementSkusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] + :ivar value: Required. The list of skus available for the subscription. + :vartype value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] :ivar next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI to fetch the next page of Resource Skus. :vartype next_link: str @@ -2800,6 +4055,10 @@ def __init__( value: List["ApiManagementSku"], **kwargs ): + """ + :keyword value: Required. The list of skus available for the subscription. + :paramtype value: list[~azure.mgmt.apimanagement.models.ApiManagementSku] + """ super(ApiManagementSkusResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2831,6 +4090,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiManagementSkuZoneDetails, self).__init__(**kwargs) self.name = None self.capabilities = None @@ -2843,8 +4104,8 @@ class ApiReleaseCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.ApiReleaseContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -2866,6 +4127,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(ApiReleaseCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -2877,21 +4142,23 @@ class ApiReleaseContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param api_id: Identifier of the API the release belongs to. - :type api_id: str + :ivar api_id: Identifier of the API the release belongs to. + :vartype api_id: str :ivar created_date_time: The time the API was released. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. :vartype created_date_time: ~datetime.datetime :ivar updated_date_time: The time the API release was updated. :vartype updated_date_time: ~datetime.datetime - :param notes: Release Notes. - :type notes: str + :ivar notes: Release Notes. + :vartype notes: str """ _validation = { @@ -2919,6 +4186,12 @@ def __init__( notes: Optional[str] = None, **kwargs ): + """ + :keyword api_id: Identifier of the API the release belongs to. + :paramtype api_id: str + :keyword notes: Release Notes. + :paramtype notes: str + """ super(ApiReleaseContract, self).__init__(**kwargs) self.api_id = api_id self.created_date_time = None @@ -2927,14 +4200,14 @@ def __init__( class ApiRevisionCollection(msrest.serialization.Model): - """Paged Api Revision list representation. + """Paged API Revision list representation. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.ApiRevisionContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -2956,6 +4229,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(ApiRevisionCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -3013,6 +4290,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiRevisionContract, self).__init__(**kwargs) self.api_id = None self.api_revision = None @@ -3027,14 +4306,14 @@ def __init__( class ApiRevisionInfoContract(msrest.serialization.Model): """Object used to create an API Revision or Version based on an existing API Revision. - :param source_api_id: Resource identifier of API to be used to create the revision from. - :type source_api_id: str - :param api_version_name: Version identifier for the new API Version. - :type api_version_name: str - :param api_revision_description: Description of new API Revision. - :type api_revision_description: str - :param api_version_set: Version set details. - :type api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + :ivar source_api_id: Resource identifier of API to be used to create the revision from. + :vartype source_api_id: str + :ivar api_version_name: Version identifier for the new API Version. + :vartype api_version_name: str + :ivar api_revision_description: Description of new API Revision. + :vartype api_revision_description: str + :ivar api_version_set: Version set details. + :vartype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails """ _validation = { @@ -3058,6 +4337,16 @@ def __init__( api_version_set: Optional["ApiVersionSetContractDetails"] = None, **kwargs ): + """ + :keyword source_api_id: Resource identifier of API to be used to create the revision from. + :paramtype source_api_id: str + :keyword api_version_name: Version identifier for the new API Version. + :paramtype api_version_name: str + :keyword api_revision_description: Description of new API Revision. + :paramtype api_revision_description: str + :keyword api_version_set: Version set details. + :paramtype api_version_set: ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetails + """ super(ApiRevisionInfoContract, self).__init__(**kwargs) self.source_api_id = source_api_id self.api_version_name = api_version_name @@ -3070,45 +4359,53 @@ class ApiTagResourceContractProperties(ApiEntityBaseContract): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param id: API identifier in the form /apis/{apiId}. - :type id: str - :param name: API name. - :type name: str - :param service_url: Absolute URL of the backend service implementing this API. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar id: API identifier in the form /apis/{apiId}. + :vartype id: str + :ivar name: API name. + :vartype name: str + :ivar service_url: Absolute URL of the backend service implementing this API. + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] """ _validation = { @@ -3135,6 +4432,9 @@ class ApiTagResourceContractProperties(ApiEntityBaseContract): 'api_version_description': {'key': 'apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'license', 'type': 'ApiLicenseInformation'}, 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'service_url': {'key': 'serviceUrl', 'type': 'str'}, @@ -3156,6 +4456,9 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, id: Optional[str] = None, name: Optional[str] = None, service_url: Optional[str] = None, @@ -3163,7 +4466,55 @@ def __init__( protocols: Optional[List[Union[str, "Protocol"]]] = None, **kwargs ): - super(ApiTagResourceContractProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, **kwargs) + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword id: API identifier in the form /apis/{apiId}. + :paramtype id: str + :keyword name: API name. + :paramtype name: str + :keyword service_url: Absolute URL of the backend service implementing this API. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + """ + super(ApiTagResourceContractProperties, self).__init__(description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=subscription_key_parameter_names, api_type=api_type, api_revision=api_revision, api_version=api_version, is_current=is_current, api_revision_description=api_revision_description, api_version_description=api_version_description, api_version_set_id=api_version_set_id, subscription_required=subscription_required, terms_of_service_url=terms_of_service_url, contact=contact, license=license, **kwargs) self.id = id self.name = name self.service_url = service_url @@ -3176,43 +4527,51 @@ class ApiUpdateContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param description: Description of the API. May include HTML formatting tags. - :type description: str - :param authentication_settings: Collection of authentication settings included into this API. - :type authentication_settings: ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract - :param subscription_key_parameter_names: Protocols over which API is made available. - :type subscription_key_parameter_names: + :ivar description: Description of the API. May include HTML formatting tags. + :vartype description: str + :ivar authentication_settings: Collection of authentication settings included into this API. + :vartype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :ivar subscription_key_parameter_names: Protocols over which API is made available. + :vartype subscription_key_parameter_names: ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract - :param api_type: Type of API. Possible values include: "http", "soap". - :type api_type: str or ~azure.mgmt.apimanagement.models.ApiType - :param api_revision: Describes the Revision of the Api. If no value is provided, default + :ivar api_type: Type of API. Possible values include: "http", "soap", "websocket", "graphql". + :vartype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :ivar api_revision: Describes the revision of the API. If no value is provided, default revision 1 is created. - :type api_revision: str - :param api_version: Indicates the Version identifier of the API if the API is versioned. - :type api_version: str - :param is_current: Indicates if API revision is current api revision. - :type is_current: bool + :vartype api_revision: str + :ivar api_version: Indicates the version identifier of the API if the API is versioned. + :vartype api_version: str + :ivar is_current: Indicates if API revision is current api revision. + :vartype is_current: bool :ivar is_online: Indicates if API revision is accessible via the gateway. :vartype is_online: bool - :param api_revision_description: Description of the Api Revision. - :type api_revision_description: str - :param api_version_description: Description of the Api Version. - :type api_version_description: str - :param api_version_set_id: A resource identifier for the related ApiVersionSet. - :type api_version_set_id: str - :param subscription_required: Specifies whether an API or Product subscription is required for + :ivar api_revision_description: Description of the API Revision. + :vartype api_revision_description: str + :ivar api_version_description: Description of the API Version. + :vartype api_version_description: str + :ivar api_version_set_id: A resource identifier for the related ApiVersionSet. + :vartype api_version_set_id: str + :ivar subscription_required: Specifies whether an API or Product subscription is required for accessing the API. - :type subscription_required: bool - :param display_name: API name. - :type display_name: str - :param service_url: Absolute URL of the backend service implementing this API. - :type service_url: str - :param path: Relative URL uniquely identifying this API and all of its resource paths within - the API Management service instance. It is appended to the API endpoint base URL specified - during the service instance creation to form a public URL for this API. - :type path: str - :param protocols: Describes on which protocols the operations in this API can be invoked. - :type protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + :vartype subscription_required: bool + :ivar terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format of + a URL. + :vartype terms_of_service_url: str + :ivar contact: Contact information for the API. + :vartype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :ivar license: License information for the API. + :vartype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :ivar display_name: API name. + :vartype display_name: str + :ivar service_url: Absolute URL of the backend service implementing this API. + :vartype service_url: str + :ivar path: Relative URL uniquely identifying this API and all of its resource paths within the + API Management service instance. It is appended to the API endpoint base URL specified during + the service instance creation to form a public URL for this API. + :vartype path: str + :ivar protocols: Describes on which protocols the operations in this API can be invoked. + :vartype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] """ _validation = { @@ -3239,6 +4598,9 @@ class ApiUpdateContract(msrest.serialization.Model): 'api_version_description': {'key': 'properties.apiVersionDescription', 'type': 'str'}, 'api_version_set_id': {'key': 'properties.apiVersionSetId', 'type': 'str'}, 'subscription_required': {'key': 'properties.subscriptionRequired', 'type': 'bool'}, + 'terms_of_service_url': {'key': 'properties.termsOfServiceUrl', 'type': 'str'}, + 'contact': {'key': 'properties.contact', 'type': 'ApiContactInformation'}, + 'license': {'key': 'properties.license', 'type': 'ApiLicenseInformation'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, 'path': {'key': 'properties.path', 'type': 'str'}, @@ -3259,12 +4621,61 @@ def __init__( api_version_description: Optional[str] = None, api_version_set_id: Optional[str] = None, subscription_required: Optional[bool] = None, + terms_of_service_url: Optional[str] = None, + contact: Optional["ApiContactInformation"] = None, + license: Optional["ApiLicenseInformation"] = None, display_name: Optional[str] = None, service_url: Optional[str] = None, path: Optional[str] = None, protocols: Optional[List[Union[str, "Protocol"]]] = None, **kwargs ): + """ + :keyword description: Description of the API. May include HTML formatting tags. + :paramtype description: str + :keyword authentication_settings: Collection of authentication settings included into this API. + :paramtype authentication_settings: + ~azure.mgmt.apimanagement.models.AuthenticationSettingsContract + :keyword subscription_key_parameter_names: Protocols over which API is made available. + :paramtype subscription_key_parameter_names: + ~azure.mgmt.apimanagement.models.SubscriptionKeyParameterNamesContract + :keyword api_type: Type of API. Possible values include: "http", "soap", "websocket", + "graphql". + :paramtype api_type: str or ~azure.mgmt.apimanagement.models.ApiType + :keyword api_revision: Describes the revision of the API. If no value is provided, default + revision 1 is created. + :paramtype api_revision: str + :keyword api_version: Indicates the version identifier of the API if the API is versioned. + :paramtype api_version: str + :keyword is_current: Indicates if API revision is current api revision. + :paramtype is_current: bool + :keyword api_revision_description: Description of the API Revision. + :paramtype api_revision_description: str + :keyword api_version_description: Description of the API Version. + :paramtype api_version_description: str + :keyword api_version_set_id: A resource identifier for the related ApiVersionSet. + :paramtype api_version_set_id: str + :keyword subscription_required: Specifies whether an API or Product subscription is required + for accessing the API. + :paramtype subscription_required: bool + :keyword terms_of_service_url: A URL to the Terms of Service for the API. MUST be in the format + of a URL. + :paramtype terms_of_service_url: str + :keyword contact: Contact information for the API. + :paramtype contact: ~azure.mgmt.apimanagement.models.ApiContactInformation + :keyword license: License information for the API. + :paramtype license: ~azure.mgmt.apimanagement.models.ApiLicenseInformation + :keyword display_name: API name. + :paramtype display_name: str + :keyword service_url: Absolute URL of the backend service implementing this API. + :paramtype service_url: str + :keyword path: Relative URL uniquely identifying this API and all of its resource paths within + the API Management service instance. It is appended to the API endpoint base URL specified + during the service instance creation to form a public URL for this API. + :paramtype path: str + :keyword protocols: Describes on which protocols the operations in this API can be invoked. + :paramtype protocols: list[str or ~azure.mgmt.apimanagement.models.Protocol] + """ super(ApiUpdateContract, self).__init__(**kwargs) self.description = description self.authentication_settings = authentication_settings @@ -3278,6 +4689,9 @@ def __init__( self.api_version_description = api_version_description self.api_version_set_id = api_version_set_id self.subscription_required = subscription_required + self.terms_of_service_url = terms_of_service_url + self.contact = contact + self.license = license self.display_name = display_name self.service_url = service_url self.path = path @@ -3287,9 +4701,9 @@ def __init__( class ApiVersionConstraint(msrest.serialization.Model): """Control Plane Apis version constraint for the API Management service. - :param min_api_version: Limit control plane API calls to API Management service with version + :ivar min_api_version: Limit control plane API calls to API Management service with version equal to or newer than this value. - :type min_api_version: str + :vartype min_api_version: str """ _attribute_map = { @@ -3302,19 +4716,24 @@ def __init__( min_api_version: Optional[str] = None, **kwargs ): + """ + :keyword min_api_version: Limit control plane API calls to API Management service with version + equal to or newer than this value. + :paramtype min_api_version: str + """ super(ApiVersionConstraint, self).__init__(**kwargs) self.min_api_version = min_api_version class ApiVersionSetCollection(msrest.serialization.Model): - """Paged Api Version Set list representation. + """Paged API Version Set list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -3331,6 +4750,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ApiVersionSetContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(ApiVersionSetCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -3338,29 +4765,31 @@ def __init__( class ApiVersionSetContract(Resource): - """Api Version Set Contract details. + """API Version Set Contract details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Name of API Version Set. - :type display_name: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :vartype version_header_name: str + :ivar display_name: Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3393,6 +4822,21 @@ def __init__( versioning_scheme: Optional[Union[str, "VersioningScheme"]] = None, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetContract, self).__init__(**kwargs) self.description = description self.version_query_name = version_query_name @@ -3404,23 +4848,22 @@ def __init__( class ApiVersionSetContractDetails(msrest.serialization.Model): """An API Version Set contains the common configuration for a set of API Versions relating. - :param id: Identifier for existing API Version Set. Omit this value to create a new Version - Set. - :type id: str - :param name: The display Name of the API Version Set. - :type name: str - :param description: Description of API Version Set. - :type description: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :ivar id: Identifier for existing API Version Set. Omit this value to create a new Version Set. + :vartype id: str + :ivar name: The display Name of the API Version Set. + :vartype name: str + :ivar description: Description of API Version Set. + :vartype description: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetailsVersioningScheme - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str + :vartype version_header_name: str """ _attribute_map = { @@ -3443,6 +4886,25 @@ def __init__( version_header_name: Optional[str] = None, **kwargs ): + """ + :keyword id: Identifier for existing API Version Set. Omit this value to create a new Version + Set. + :paramtype id: str + :keyword name: The display Name of the API Version Set. + :paramtype name: str + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or + ~azure.mgmt.apimanagement.models.ApiVersionSetContractDetailsVersioningScheme + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + """ super(ApiVersionSetContractDetails, self).__init__(**kwargs) self.id = id self.name = name @@ -3453,16 +4915,16 @@ def __init__( class ApiVersionSetEntityBase(msrest.serialization.Model): - """Api Version set base parameters. + """API Version set base parameters. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str + :vartype version_header_name: str """ _validation = { @@ -3484,6 +4946,16 @@ def __init__( version_header_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + """ super(ApiVersionSetEntityBase, self).__init__(**kwargs) self.description = description self.version_query_name = version_query_name @@ -3495,19 +4967,19 @@ class ApiVersionSetContractProperties(ApiVersionSetEntityBase): All required parameters must be populated in order to send to Azure. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Required. Name of API Version Set. - :type display_name: str - :param versioning_scheme: Required. An value that determines where the API Version identifier + :vartype version_header_name: str + :ivar display_name: Required. Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: Required. An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3535,27 +5007,42 @@ def __init__( version_header_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Required. Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: Required. An value that determines where the API Version identifier + will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetContractProperties, self).__init__(description=description, version_query_name=version_query_name, version_header_name=version_header_name, **kwargs) self.display_name = display_name self.versioning_scheme = versioning_scheme class ApiVersionSetUpdateParameters(msrest.serialization.Model): - """Parameters to update or create an Api Version Set Contract. + """Parameters to update or create an API Version Set Contract. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Name of API Version Set. - :type display_name: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :vartype version_header_name: str + :ivar display_name: Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3582,6 +5069,21 @@ def __init__( versioning_scheme: Optional[Union[str, "VersioningScheme"]] = None, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetUpdateParameters, self).__init__(**kwargs) self.description = description self.version_query_name = version_query_name @@ -3593,19 +5095,19 @@ def __init__( class ApiVersionSetUpdateParametersProperties(ApiVersionSetEntityBase): """Properties used to create or update an API Version Set. - :param description: Description of API Version Set. - :type description: str - :param version_query_name: Name of query parameter that indicates the API Version if + :ivar description: Description of API Version Set. + :vartype description: str + :ivar version_query_name: Name of query parameter that indicates the API Version if versioningScheme is set to ``query``. - :type version_query_name: str - :param version_header_name: Name of HTTP header parameter that indicates the API Version if + :vartype version_query_name: str + :ivar version_header_name: Name of HTTP header parameter that indicates the API Version if versioningScheme is set to ``header``. - :type version_header_name: str - :param display_name: Name of API Version Set. - :type display_name: str - :param versioning_scheme: An value that determines where the API Version identifier will be + :vartype version_header_name: str + :ivar display_name: Name of API Version Set. + :vartype display_name: str + :ivar versioning_scheme: An value that determines where the API Version identifier will be located in a HTTP request. Possible values include: "Segment", "Query", "Header". - :type versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + :vartype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme """ _validation = { @@ -3632,25 +5134,69 @@ def __init__( versioning_scheme: Optional[Union[str, "VersioningScheme"]] = None, **kwargs ): + """ + :keyword description: Description of API Version Set. + :paramtype description: str + :keyword version_query_name: Name of query parameter that indicates the API Version if + versioningScheme is set to ``query``. + :paramtype version_query_name: str + :keyword version_header_name: Name of HTTP header parameter that indicates the API Version if + versioningScheme is set to ``header``. + :paramtype version_header_name: str + :keyword display_name: Name of API Version Set. + :paramtype display_name: str + :keyword versioning_scheme: An value that determines where the API Version identifier will be + located in a HTTP request. Possible values include: "Segment", "Query", "Header". + :paramtype versioning_scheme: str or ~azure.mgmt.apimanagement.models.VersioningScheme + """ super(ApiVersionSetUpdateParametersProperties, self).__init__(description=description, version_query_name=version_query_name, version_header_name=version_header_name, **kwargs) self.display_name = display_name self.versioning_scheme = versioning_scheme +class ArmIdWrapper(msrest.serialization.Model): + """A wrapper for an ARM resource id. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ArmIdWrapper, self).__init__(**kwargs) + self.id = None + + class AssociationContract(Resource): """Association entity details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param provisioning_state: Provisioning state. The only acceptable values to pass in are None + :ivar provisioning_state: Provisioning state. The only acceptable values to pass in are None and "created". The default value is None. - :type provisioning_state: str + :vartype provisioning_state: str """ _validation = { @@ -3672,6 +5218,11 @@ def __init__( provisioning_state: Optional[str] = None, **kwargs ): + """ + :keyword provisioning_state: Provisioning state. The only acceptable values to pass in are None + and "created". The default value is None. + :paramtype provisioning_state: str + """ super(AssociationContract, self).__init__(**kwargs) self.provisioning_state = provisioning_state @@ -3679,10 +5230,10 @@ def __init__( class AuthenticationSettingsContract(msrest.serialization.Model): """API Authentication Settings. - :param o_auth2: OAuth2 Authentication settings. - :type o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract - :param openid: OpenID Connect Authentication Settings. - :type openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + :ivar o_auth2: OAuth2 Authentication settings. + :vartype o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract + :ivar openid: OpenID Connect Authentication Settings. + :vartype openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract """ _attribute_map = { @@ -3697,6 +5248,12 @@ def __init__( openid: Optional["OpenIdAuthenticationSettingsContract"] = None, **kwargs ): + """ + :keyword o_auth2: OAuth2 Authentication settings. + :paramtype o_auth2: ~azure.mgmt.apimanagement.models.OAuth2AuthenticationSettingsContract + :keyword openid: OpenID Connect Authentication Settings. + :paramtype openid: ~azure.mgmt.apimanagement.models.OpenIdAuthenticationSettingsContract + """ super(AuthenticationSettingsContract, self).__init__(**kwargs) self.o_auth2 = o_auth2 self.openid = openid @@ -3705,12 +5262,12 @@ def __init__( class AuthorizationServerCollection(msrest.serialization.Model): """Paged OAuth2 Authorization Servers list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -3727,6 +5284,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.AuthorizationServerContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(AuthorizationServerCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -3738,65 +5303,69 @@ class AuthorizationServerContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Form of an authorization grant, which the client uses to request the access + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -3849,6 +5418,65 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerContract, self).__init__(**kwargs) self.description = description self.authorization_methods = authorization_methods @@ -3871,41 +5499,43 @@ def __init__( class AuthorizationServerContractBaseProperties(msrest.serialization.Model): """External OAuth authorization server Update settings contract. - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str + :vartype resource_owner_password: str """ _attribute_map = { @@ -3936,6 +5566,47 @@ def __init__( resource_owner_password: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + """ super(AuthorizationServerContractBaseProperties, self).__init__(**kwargs) self.description = description self.authorization_methods = authorization_methods @@ -3954,59 +5625,61 @@ class AuthorizationServerContractProperties(AuthorizationServerContractBasePrope All required parameters must be populated in order to send to Azure. - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: Required. User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Required. Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: Required. User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Required. Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: Required. OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: Required. OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Required. Form of an authorization grant, which the client uses to request + :vartype authorization_endpoint: str + :ivar grant_types: Required. Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Required. Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Required. Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -4057,6 +5730,65 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: Required. User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Required. Optional reference to a page where client or + app registration for this authorization server is performed. Contains absolute URL to entity + being referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: Required. OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Required. Form of an authorization grant, which the client uses to + request the access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Required. Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerContractProperties, self).__init__(description=description, authorization_methods=authorization_methods, client_authentication_method=client_authentication_method, token_body_parameters=token_body_parameters, token_endpoint=token_endpoint, support_state=support_state, default_scope=default_scope, bearer_token_sending_methods=bearer_token_sending_methods, resource_owner_username=resource_owner_username, resource_owner_password=resource_owner_password, **kwargs) self.display_name = display_name self.client_registration_endpoint = client_registration_endpoint @@ -4069,14 +5801,14 @@ def __init__( class AuthorizationServerSecretsContract(msrest.serialization.Model): """OAuth Server Secrets Contract. - :param client_secret: oAuth Authorization Server Secrets. - :type client_secret: str - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar client_secret: oAuth Authorization Server Secrets. + :vartype client_secret: str + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str + :vartype resource_owner_password: str """ _attribute_map = { @@ -4093,6 +5825,16 @@ def __init__( resource_owner_password: Optional[str] = None, **kwargs ): + """ + :keyword client_secret: oAuth Authorization Server Secrets. + :paramtype client_secret: str + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + """ super(AuthorizationServerSecretsContract, self).__init__(**kwargs) self.client_secret = client_secret self.resource_owner_username = resource_owner_username @@ -4104,65 +5846,69 @@ class AuthorizationServerUpdateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Form of an authorization grant, which the client uses to request the access + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -4215,6 +5961,65 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerUpdateContract, self).__init__(**kwargs) self.description = description self.authorization_methods = authorization_methods @@ -4237,59 +6042,61 @@ def __init__( class AuthorizationServerUpdateContractProperties(AuthorizationServerContractBaseProperties): """External OAuth authorization server Update settings contract. - :param description: Description of the authorization server. Can contain HTML formatting tags. - :type description: str - :param authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + :ivar description: Description of the authorization server. Can contain HTML formatting tags. + :vartype description: str + :ivar authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be always present. POST is optional. - :type authorization_methods: list[str or ~azure.mgmt.apimanagement.models.AuthorizationMethod] - :param client_authentication_method: Method of authentication supported by the token endpoint - of this authorization server. Possible values are Basic and/or Body. When Body is specified, + :vartype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :ivar client_authentication_method: Method of authentication supported by the token endpoint of + this authorization server. Possible values are Basic and/or Body. When Body is specified, client credentials and other parameters are passed within the request body in the application/x-www-form-urlencoded format. - :type client_authentication_method: list[str or + :vartype client_authentication_method: list[str or ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] - :param token_body_parameters: Additional parameters required by the token endpoint of this + :ivar token_body_parameters: Additional parameters required by the token endpoint of this authorization server represented as an array of JSON objects with name and value string properties, i.e. {"name" : "name value", "value": "a value"}. - :type token_body_parameters: list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] - :param token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. - :type token_endpoint: str - :param support_state: If true, authorization server will include state parameter from the + :vartype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :ivar token_endpoint: OAuth token endpoint. Contains absolute URI to entity being referenced. + :vartype token_endpoint: str + :ivar support_state: If true, authorization server will include state parameter from the authorization request to its response. Client may use state parameter to raise protocol security. - :type support_state: bool - :param default_scope: Access token scope that is going to be requested by default. Can be + :vartype support_state: bool + :ivar default_scope: Access token scope that is going to be requested by default. Can be overridden at the API level. Should be provided in the form of a string containing space-delimited values. - :type default_scope: str - :param bearer_token_sending_methods: Specifies the mechanism by which access token is passed to + :vartype default_scope: str + :ivar bearer_token_sending_methods: Specifies the mechanism by which access token is passed to the API. - :type bearer_token_sending_methods: list[str or + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] - :param resource_owner_username: Can be optionally specified when resource owner password grant + :ivar resource_owner_username: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner username. - :type resource_owner_username: str - :param resource_owner_password: Can be optionally specified when resource owner password grant + :vartype resource_owner_username: str + :ivar resource_owner_password: Can be optionally specified when resource owner password grant type is supported by this authorization server. Default resource owner password. - :type resource_owner_password: str - :param display_name: User-friendly authorization server name. - :type display_name: str - :param client_registration_endpoint: Optional reference to a page where client or app + :vartype resource_owner_password: str + :ivar display_name: User-friendly authorization server name. + :vartype display_name: str + :ivar client_registration_endpoint: Optional reference to a page where client or app registration for this authorization server is performed. Contains absolute URL to entity being referenced. - :type client_registration_endpoint: str - :param authorization_endpoint: OAuth authorization endpoint. See + :vartype client_registration_endpoint: str + :ivar authorization_endpoint: OAuth authorization endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - :type authorization_endpoint: str - :param grant_types: Form of an authorization grant, which the client uses to request the access + :vartype authorization_endpoint: str + :ivar grant_types: Form of an authorization grant, which the client uses to request the access token. - :type grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] - :param client_id: Client or app id registered with this authorization server. - :type client_id: str - :param client_secret: Client or app secret registered with this authorization server. This + :vartype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :ivar client_id: Client or app id registered with this authorization server. + :vartype client_id: str + :ivar client_secret: Client or app secret registered with this authorization server. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -4336,6 +6143,65 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the authorization server. Can contain HTML formatting + tags. + :paramtype description: str + :keyword authorization_methods: HTTP verbs supported by the authorization endpoint. GET must be + always present. POST is optional. + :paramtype authorization_methods: list[str or + ~azure.mgmt.apimanagement.models.AuthorizationMethod] + :keyword client_authentication_method: Method of authentication supported by the token endpoint + of this authorization server. Possible values are Basic and/or Body. When Body is specified, + client credentials and other parameters are passed within the request body in the + application/x-www-form-urlencoded format. + :paramtype client_authentication_method: list[str or + ~azure.mgmt.apimanagement.models.ClientAuthenticationMethod] + :keyword token_body_parameters: Additional parameters required by the token endpoint of this + authorization server represented as an array of JSON objects with name and value string + properties, i.e. {"name" : "name value", "value": "a value"}. + :paramtype token_body_parameters: + list[~azure.mgmt.apimanagement.models.TokenBodyParameterContract] + :keyword token_endpoint: OAuth token endpoint. Contains absolute URI to entity being + referenced. + :paramtype token_endpoint: str + :keyword support_state: If true, authorization server will include state parameter from the + authorization request to its response. Client may use state parameter to raise protocol + security. + :paramtype support_state: bool + :keyword default_scope: Access token scope that is going to be requested by default. Can be + overridden at the API level. Should be provided in the form of a string containing + space-delimited values. + :paramtype default_scope: str + :keyword bearer_token_sending_methods: Specifies the mechanism by which access token is passed + to the API. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethod] + :keyword resource_owner_username: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner username. + :paramtype resource_owner_username: str + :keyword resource_owner_password: Can be optionally specified when resource owner password + grant type is supported by this authorization server. Default resource owner password. + :paramtype resource_owner_password: str + :keyword display_name: User-friendly authorization server name. + :paramtype display_name: str + :keyword client_registration_endpoint: Optional reference to a page where client or app + registration for this authorization server is performed. Contains absolute URL to entity being + referenced. + :paramtype client_registration_endpoint: str + :keyword authorization_endpoint: OAuth authorization endpoint. See + http://tools.ietf.org/html/rfc6749#section-3.2. + :paramtype authorization_endpoint: str + :keyword grant_types: Form of an authorization grant, which the client uses to request the + access token. + :paramtype grant_types: list[str or ~azure.mgmt.apimanagement.models.GrantType] + :keyword client_id: Client or app id registered with this authorization server. + :paramtype client_id: str + :keyword client_secret: Client or app secret registered with this authorization server. This + property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the + value. + :paramtype client_secret: str + """ super(AuthorizationServerUpdateContractProperties, self).__init__(description=description, authorization_methods=authorization_methods, client_authentication_method=client_authentication_method, token_body_parameters=token_body_parameters, token_endpoint=token_endpoint, support_state=support_state, default_scope=default_scope, bearer_token_sending_methods=bearer_token_sending_methods, resource_owner_username=resource_owner_username, resource_owner_password=resource_owner_password, **kwargs) self.display_name = display_name self.client_registration_endpoint = client_registration_endpoint @@ -4350,10 +6216,10 @@ class BackendAuthorizationHeaderCredentials(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scheme: Required. Authentication Scheme name. - :type scheme: str - :param parameter: Required. Authentication Parameter value. - :type parameter: str + :ivar scheme: Required. Authentication Scheme name. + :vartype scheme: str + :ivar parameter: Required. Authentication Parameter value. + :vartype parameter: str """ _validation = { @@ -4373,6 +6239,12 @@ def __init__( parameter: str, **kwargs ): + """ + :keyword scheme: Required. Authentication Scheme name. + :paramtype scheme: str + :keyword parameter: Required. Authentication Parameter value. + :paramtype parameter: str + """ super(BackendAuthorizationHeaderCredentials, self).__init__(**kwargs) self.scheme = scheme self.parameter = parameter @@ -4381,21 +6253,21 @@ def __init__( class BackendBaseParameters(msrest.serialization.Model): """Backend entity base Parameter set. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties """ _validation = { @@ -4426,6 +6298,23 @@ def __init__( tls: Optional["BackendTlsProperties"] = None, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + """ super(BackendBaseParameters, self).__init__(**kwargs) self.title = title self.description = description @@ -4439,12 +6328,12 @@ def __init__( class BackendCollection(msrest.serialization.Model): """Paged Backend list representation. - :param value: Backend values. - :type value: list[~azure.mgmt.apimanagement.models.BackendContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Backend values. + :vartype value: list[~azure.mgmt.apimanagement.models.BackendContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -4461,6 +6350,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Backend values. + :paramtype value: list[~azure.mgmt.apimanagement.models.BackendContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(BackendCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -4472,31 +6369,33 @@ class BackendContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Runtime Url of the Backend. - :type url: str - :param protocol: Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Backend communication protocol. Possible values include: "http", "soap". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4538,6 +6437,27 @@ def __init__( protocol: Optional[Union[str, "BackendProtocol"]] = None, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Backend communication protocol. Possible values include: "http", "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendContract, self).__init__(**kwargs) self.title = title self.description = description @@ -4555,26 +6475,26 @@ class BackendContractProperties(BackendBaseParameters): All required parameters must be populated in order to send to Azure. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Required. Runtime Url of the Backend. - :type url: str - :param protocol: Required. Backend communication protocol. Possible values include: "http", + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Required. Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Required. Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4611,6 +6531,28 @@ def __init__( tls: Optional["BackendTlsProperties"] = None, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Required. Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Required. Backend communication protocol. Possible values include: "http", + "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendContractProperties, self).__init__(title=title, description=description, resource_id=resource_id, properties=properties, credentials=credentials, proxy=proxy, tls=tls, **kwargs) self.url = url self.protocol = protocol @@ -4619,17 +6561,17 @@ def __init__( class BackendCredentialsContract(msrest.serialization.Model): """Details of the Credentials used to connect to Backend. - :param certificate_ids: List of Client Certificate Ids. - :type certificate_ids: list[str] - :param certificate: List of Client Certificate Thumbprints. Will be ignored if certificatesIds + :ivar certificate_ids: List of Client Certificate Ids. + :vartype certificate_ids: list[str] + :ivar certificate: List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided. - :type certificate: list[str] - :param query: Query Parameter description. - :type query: dict[str, list[str]] - :param header: Header Parameter description. - :type header: dict[str, list[str]] - :param authorization: Authorization header authentication. - :type authorization: ~azure.mgmt.apimanagement.models.BackendAuthorizationHeaderCredentials + :vartype certificate: list[str] + :ivar query: Query Parameter description. + :vartype query: dict[str, list[str]] + :ivar header: Header Parameter description. + :vartype header: dict[str, list[str]] + :ivar authorization: Authorization header authentication. + :vartype authorization: ~azure.mgmt.apimanagement.models.BackendAuthorizationHeaderCredentials """ _validation = { @@ -4655,6 +6597,20 @@ def __init__( authorization: Optional["BackendAuthorizationHeaderCredentials"] = None, **kwargs ): + """ + :keyword certificate_ids: List of Client Certificate Ids. + :paramtype certificate_ids: list[str] + :keyword certificate: List of Client Certificate Thumbprints. Will be ignored if + certificatesIds are provided. + :paramtype certificate: list[str] + :keyword query: Query Parameter description. + :paramtype query: dict[str, list[str]] + :keyword header: Header Parameter description. + :paramtype header: dict[str, list[str]] + :keyword authorization: Authorization header authentication. + :paramtype authorization: + ~azure.mgmt.apimanagement.models.BackendAuthorizationHeaderCredentials + """ super(BackendCredentialsContract, self).__init__(**kwargs) self.certificate_ids = certificate_ids self.certificate = certificate @@ -4666,8 +6622,8 @@ def __init__( class BackendProperties(msrest.serialization.Model): """Properties specific to the Backend Type. - :param service_fabric_cluster: Backend Service Fabric Cluster Properties. - :type service_fabric_cluster: + :ivar service_fabric_cluster: Backend Service Fabric Cluster Properties. + :vartype service_fabric_cluster: ~azure.mgmt.apimanagement.models.BackendServiceFabricClusterProperties """ @@ -4681,6 +6637,11 @@ def __init__( service_fabric_cluster: Optional["BackendServiceFabricClusterProperties"] = None, **kwargs ): + """ + :keyword service_fabric_cluster: Backend Service Fabric Cluster Properties. + :paramtype service_fabric_cluster: + ~azure.mgmt.apimanagement.models.BackendServiceFabricClusterProperties + """ super(BackendProperties, self).__init__(**kwargs) self.service_fabric_cluster = service_fabric_cluster @@ -4690,13 +6651,13 @@ class BackendProxyContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. WebProxy Server AbsoluteUri property which includes the entire URI stored + :ivar url: Required. WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings. - :type url: str - :param username: Username to connect to the WebProxy server. - :type username: str - :param password: Password to connect to the WebProxy Server. - :type password: str + :vartype url: str + :ivar username: Username to connect to the WebProxy server. + :vartype username: str + :ivar password: Password to connect to the WebProxy Server. + :vartype password: str """ _validation = { @@ -4717,6 +6678,15 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword url: Required. WebProxy Server AbsoluteUri property which includes the entire URI + stored in the Uri instance, including all fragments and query strings. + :paramtype url: str + :keyword username: Username to connect to the WebProxy server. + :paramtype username: str + :keyword password: Password to connect to the WebProxy Server. + :paramtype password: str + """ super(BackendProxyContract, self).__init__(**kwargs) self.url = url self.username = username @@ -4728,15 +6698,17 @@ class BackendReconnectContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param after: Duration in ISO8601 format after which reconnect will be initiated. Minimum + :ivar after: Duration in ISO8601 format after which reconnect will be initiated. Minimum duration of the Reconnect is PT2M. - :type after: ~datetime.timedelta + :vartype after: ~datetime.timedelta """ _validation = { @@ -4758,6 +6730,11 @@ def __init__( after: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword after: Duration in ISO8601 format after which reconnect will be initiated. Minimum + duration of the Reconnect is PT2M. + :paramtype after: ~datetime.timedelta + """ super(BackendReconnectContract, self).__init__(**kwargs) self.after = after @@ -4767,21 +6744,21 @@ class BackendServiceFabricClusterProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client_certificate_id: The client certificate id for the management endpoint. - :type client_certificate_id: str - :param client_certificatethumbprint: The client certificate thumbprint for the management + :ivar client_certificate_id: The client certificate id for the management endpoint. + :vartype client_certificate_id: str + :ivar client_certificatethumbprint: The client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided. - :type client_certificatethumbprint: str - :param max_partition_resolution_retries: Maximum number of retries while attempting resolve the + :vartype client_certificatethumbprint: str + :ivar max_partition_resolution_retries: Maximum number of retries while attempting resolve the partition. - :type max_partition_resolution_retries: int - :param management_endpoints: Required. The cluster management endpoint. - :type management_endpoints: list[str] - :param server_certificate_thumbprints: Thumbprints of certificates cluster management service + :vartype max_partition_resolution_retries: int + :ivar management_endpoints: Required. The cluster management endpoint. + :vartype management_endpoints: list[str] + :ivar server_certificate_thumbprints: Thumbprints of certificates cluster management service uses for tls communication. - :type server_certificate_thumbprints: list[str] - :param server_x509_names: Server X509 Certificate Names Collection. - :type server_x509_names: list[~azure.mgmt.apimanagement.models.X509CertificateName] + :vartype server_certificate_thumbprints: list[str] + :ivar server_x509_names: Server X509 Certificate Names Collection. + :vartype server_x509_names: list[~azure.mgmt.apimanagement.models.X509CertificateName] """ _validation = { @@ -4808,6 +6785,23 @@ def __init__( server_x509_names: Optional[List["X509CertificateName"]] = None, **kwargs ): + """ + :keyword client_certificate_id: The client certificate id for the management endpoint. + :paramtype client_certificate_id: str + :keyword client_certificatethumbprint: The client certificate thumbprint for the management + endpoint. Will be ignored if certificatesIds are provided. + :paramtype client_certificatethumbprint: str + :keyword max_partition_resolution_retries: Maximum number of retries while attempting resolve + the partition. + :paramtype max_partition_resolution_retries: int + :keyword management_endpoints: Required. The cluster management endpoint. + :paramtype management_endpoints: list[str] + :keyword server_certificate_thumbprints: Thumbprints of certificates cluster management service + uses for tls communication. + :paramtype server_certificate_thumbprints: list[str] + :keyword server_x509_names: Server X509 Certificate Names Collection. + :paramtype server_x509_names: list[~azure.mgmt.apimanagement.models.X509CertificateName] + """ super(BackendServiceFabricClusterProperties, self).__init__(**kwargs) self.client_certificate_id = client_certificate_id self.client_certificatethumbprint = client_certificatethumbprint @@ -4820,12 +6814,12 @@ def __init__( class BackendTlsProperties(msrest.serialization.Model): """Properties controlling TLS Certificate Validation. - :param validate_certificate_chain: Flag indicating whether SSL certificate chain validation + :ivar validate_certificate_chain: Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host. - :type validate_certificate_chain: bool - :param validate_certificate_name: Flag indicating whether SSL certificate name validation - should be done when using self-signed certificates for this backend host. - :type validate_certificate_name: bool + :vartype validate_certificate_chain: bool + :ivar validate_certificate_name: Flag indicating whether SSL certificate name validation should + be done when using self-signed certificates for this backend host. + :vartype validate_certificate_name: bool """ _attribute_map = { @@ -4840,6 +6834,14 @@ def __init__( validate_certificate_name: Optional[bool] = True, **kwargs ): + """ + :keyword validate_certificate_chain: Flag indicating whether SSL certificate chain validation + should be done when using self-signed certificates for this backend host. + :paramtype validate_certificate_chain: bool + :keyword validate_certificate_name: Flag indicating whether SSL certificate name validation + should be done when using self-signed certificates for this backend host. + :paramtype validate_certificate_name: bool + """ super(BackendTlsProperties, self).__init__(**kwargs) self.validate_certificate_chain = validate_certificate_chain self.validate_certificate_name = validate_certificate_name @@ -4848,25 +6850,25 @@ def __init__( class BackendUpdateParameterProperties(BackendBaseParameters): """Parameters supplied to the Update Backend operation. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Runtime Url of the Backend. - :type url: str - :param protocol: Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Backend communication protocol. Possible values include: "http", "soap". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4902,6 +6904,27 @@ def __init__( protocol: Optional[Union[str, "BackendProtocol"]] = None, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Backend communication protocol. Possible values include: "http", "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendUpdateParameterProperties, self).__init__(title=title, description=description, resource_id=resource_id, properties=properties, credentials=credentials, proxy=proxy, tls=tls, **kwargs) self.url = url self.protocol = protocol @@ -4910,25 +6933,25 @@ def __init__( class BackendUpdateParameters(msrest.serialization.Model): """Backend update parameters. - :param title: Backend Title. - :type title: str - :param description: Backend Description. - :type description: str - :param resource_id: Management Uri of the Resource in External System. This url can be the Arm - Resource Id of Logic Apps, Function Apps or Api Apps. - :type resource_id: str - :param properties: Backend Properties contract. - :type properties: ~azure.mgmt.apimanagement.models.BackendProperties - :param credentials: Backend Credentials Contract Properties. - :type credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract - :param proxy: Backend Proxy Contract Properties. - :type proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract - :param tls: Backend TLS Properties. - :type tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties - :param url: Runtime Url of the Backend. - :type url: str - :param protocol: Backend communication protocol. Possible values include: "http", "soap". - :type protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + :ivar title: Backend Title. + :vartype title: str + :ivar description: Backend Description. + :vartype description: str + :ivar resource_id: Management Uri of the Resource in External System. This url can be the Arm + Resource Id of Logic Apps, Function Apps or API Apps. + :vartype resource_id: str + :ivar properties: Backend Properties contract. + :vartype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :ivar credentials: Backend Credentials Contract Properties. + :vartype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :ivar proxy: Backend Proxy Contract Properties. + :vartype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :ivar tls: Backend TLS Properties. + :vartype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :ivar url: Runtime Url of the Backend. + :vartype url: str + :ivar protocol: Backend communication protocol. Possible values include: "http", "soap". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol """ _validation = { @@ -4964,6 +6987,27 @@ def __init__( protocol: Optional[Union[str, "BackendProtocol"]] = None, **kwargs ): + """ + :keyword title: Backend Title. + :paramtype title: str + :keyword description: Backend Description. + :paramtype description: str + :keyword resource_id: Management Uri of the Resource in External System. This url can be the + Arm Resource Id of Logic Apps, Function Apps or API Apps. + :paramtype resource_id: str + :keyword properties: Backend Properties contract. + :paramtype properties: ~azure.mgmt.apimanagement.models.BackendProperties + :keyword credentials: Backend Credentials Contract Properties. + :paramtype credentials: ~azure.mgmt.apimanagement.models.BackendCredentialsContract + :keyword proxy: Backend Proxy Contract Properties. + :paramtype proxy: ~azure.mgmt.apimanagement.models.BackendProxyContract + :keyword tls: Backend TLS Properties. + :paramtype tls: ~azure.mgmt.apimanagement.models.BackendTlsProperties + :keyword url: Runtime Url of the Backend. + :paramtype url: str + :keyword protocol: Backend communication protocol. Possible values include: "http", "soap". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.BackendProtocol + """ super(BackendUpdateParameters, self).__init__(**kwargs) self.title = title self.description = description @@ -4979,8 +7023,8 @@ def __init__( class BodyDiagnosticSettings(msrest.serialization.Model): """Body logging settings. - :param bytes: Number of request body bytes to log. - :type bytes: int + :ivar bytes: Number of request body bytes to log. + :vartype bytes: int """ _validation = { @@ -4997,6 +7041,10 @@ def __init__( bytes: Optional[int] = None, **kwargs ): + """ + :keyword bytes: Number of request body bytes to log. + :paramtype bytes: int + """ super(BodyDiagnosticSettings, self).__init__(**kwargs) self.bytes = bytes @@ -5004,12 +7052,12 @@ def __init__( class CacheCollection(msrest.serialization.Model): """Paged Caches list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.CacheContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.CacheContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5026,6 +7074,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.CacheContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(CacheCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -5037,21 +7093,23 @@ class CacheContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Cache description. - :type description: str - :param connection_string: Runtime connection string to cache. - :type connection_string: str - :param use_from_location: Location identifier to use cache from (should be either 'default' or + :ivar description: Cache description. + :vartype description: str + :ivar connection_string: Runtime connection string to cache. + :vartype connection_string: str + :ivar use_from_location: Location identifier to use cache from (should be either 'default' or valid Azure region identifier). - :type use_from_location: str - :param resource_id: Original uri of entity in external system cache points to. - :type resource_id: str + :vartype use_from_location: str + :ivar resource_id: Original uri of entity in external system cache points to. + :vartype resource_id: str """ _validation = { @@ -5083,6 +7141,17 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Cache description. + :paramtype description: str + :keyword connection_string: Runtime connection string to cache. + :paramtype connection_string: str + :keyword use_from_location: Location identifier to use cache from (should be either 'default' + or valid Azure region identifier). + :paramtype use_from_location: str + :keyword resource_id: Original uri of entity in external system cache points to. + :paramtype resource_id: str + """ super(CacheContract, self).__init__(**kwargs) self.description = description self.connection_string = connection_string @@ -5093,15 +7162,15 @@ def __init__( class CacheUpdateParameters(msrest.serialization.Model): """Cache update details. - :param description: Cache description. - :type description: str - :param connection_string: Runtime connection string to cache. - :type connection_string: str - :param use_from_location: Location identifier to use cache from (should be either 'default' or + :ivar description: Cache description. + :vartype description: str + :ivar connection_string: Runtime connection string to cache. + :vartype connection_string: str + :ivar use_from_location: Location identifier to use cache from (should be either 'default' or valid Azure region identifier). - :type use_from_location: str - :param resource_id: Original uri of entity in external system cache points to. - :type resource_id: str + :vartype use_from_location: str + :ivar resource_id: Original uri of entity in external system cache points to. + :vartype resource_id: str """ _validation = { @@ -5127,6 +7196,17 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword description: Cache description. + :paramtype description: str + :keyword connection_string: Runtime connection string to cache. + :paramtype connection_string: str + :keyword use_from_location: Location identifier to use cache from (should be either 'default' + or valid Azure region identifier). + :paramtype use_from_location: str + :keyword resource_id: Original uri of entity in external system cache points to. + :paramtype resource_id: str + """ super(CacheUpdateParameters, self).__init__(**kwargs) self.description = description self.connection_string = connection_string @@ -5137,12 +7217,12 @@ def __init__( class CertificateCollection(msrest.serialization.Model): """Paged Certificates list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.CertificateContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.CertificateContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5159,6 +7239,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.CertificateContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(CertificateCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -5170,16 +7258,16 @@ class CertificateConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param encoded_certificate: Base64 Encoded certificate. - :type encoded_certificate: str - :param certificate_password: Certificate Password. - :type certificate_password: str - :param store_name: Required. The System.Security.Cryptography.x509certificates.StoreName + :ivar encoded_certificate: Base64 Encoded certificate. + :vartype encoded_certificate: str + :ivar certificate_password: Certificate Password. + :vartype certificate_password: str + :ivar store_name: Required. The System.Security.Cryptography.x509certificates.StoreName certificate store location. Only Root and CertificateAuthority are valid locations. Possible values include: "CertificateAuthority", "Root". - :type store_name: str or ~azure.mgmt.apimanagement.models.CertificateConfigurationStoreName - :param certificate: Certificate information. - :type certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :vartype store_name: str or ~azure.mgmt.apimanagement.models.CertificateConfigurationStoreName + :ivar certificate: Certificate information. + :vartype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation """ _validation = { @@ -5202,6 +7290,19 @@ def __init__( certificate: Optional["CertificateInformation"] = None, **kwargs ): + """ + :keyword encoded_certificate: Base64 Encoded certificate. + :paramtype encoded_certificate: str + :keyword certificate_password: Certificate Password. + :paramtype certificate_password: str + :keyword store_name: Required. The System.Security.Cryptography.x509certificates.StoreName + certificate store location. Only Root and CertificateAuthority are valid locations. Possible + values include: "CertificateAuthority", "Root". + :paramtype store_name: str or + ~azure.mgmt.apimanagement.models.CertificateConfigurationStoreName + :keyword certificate: Certificate information. + :paramtype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + """ super(CertificateConfiguration, self).__init__(**kwargs) self.encoded_certificate = encoded_certificate self.certificate_password = certificate_password @@ -5214,21 +7315,23 @@ class CertificateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param subject: Subject attribute of the certificate. - :type subject: str - :param thumbprint: Thumbprint of the certificate. - :type thumbprint: str - :param expiration_date: Expiration date of the certificate. The date conforms to the following + :ivar subject: Subject attribute of the certificate. + :vartype subject: str + :ivar thumbprint: Thumbprint of the certificate. + :vartype thumbprint: str + :ivar expiration_date: Expiration date of the certificate. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiration_date: ~datetime.datetime - :param key_vault: KeyVault location details of the certificate. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + :vartype expiration_date: ~datetime.datetime + :ivar key_vault: KeyVault location details of the certificate. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties """ _validation = { @@ -5256,6 +7359,17 @@ def __init__( key_vault: Optional["KeyVaultContractProperties"] = None, **kwargs ): + """ + :keyword subject: Subject attribute of the certificate. + :paramtype subject: str + :keyword thumbprint: Thumbprint of the certificate. + :paramtype thumbprint: str + :keyword expiration_date: Expiration date of the certificate. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiration_date: ~datetime.datetime + :keyword key_vault: KeyVault location details of the certificate. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + """ super(CertificateContract, self).__init__(**kwargs) self.subject = subject self.thumbprint = thumbprint @@ -5266,12 +7380,12 @@ def __init__( class CertificateCreateOrUpdateParameters(msrest.serialization.Model): """Certificate create or update details. - :param data: Base 64 encoded certificate using the application/x-pkcs12 representation. - :type data: str - :param password: Password for the Certificate. - :type password: str - :param key_vault: KeyVault location details of the certificate. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :ivar data: Base 64 encoded certificate using the application/x-pkcs12 representation. + :vartype data: str + :ivar password: Password for the Certificate. + :vartype password: str + :ivar key_vault: KeyVault location details of the certificate. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _attribute_map = { @@ -5288,6 +7402,14 @@ def __init__( key_vault: Optional["KeyVaultContractCreateProperties"] = None, **kwargs ): + """ + :keyword data: Base 64 encoded certificate using the application/x-pkcs12 representation. + :paramtype data: str + :keyword password: Password for the Certificate. + :paramtype password: str + :keyword key_vault: KeyVault location details of the certificate. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(CertificateCreateOrUpdateParameters, self).__init__(**kwargs) self.data = data self.password = password @@ -5299,13 +7421,13 @@ class CertificateInformation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param expiry: Required. Expiration date of the certificate. The date conforms to the following + :ivar expiry: Required. Expiration date of the certificate. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiry: ~datetime.datetime - :param thumbprint: Required. Thumbprint of the certificate. - :type thumbprint: str - :param subject: Required. Subject of the certificate. - :type subject: str + :vartype expiry: ~datetime.datetime + :ivar thumbprint: Required. Thumbprint of the certificate. + :vartype thumbprint: str + :ivar subject: Required. Subject of the certificate. + :vartype subject: str """ _validation = { @@ -5328,6 +7450,15 @@ def __init__( subject: str, **kwargs ): + """ + :keyword expiry: Required. Expiration date of the certificate. The date conforms to the + following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiry: ~datetime.datetime + :keyword thumbprint: Required. Thumbprint of the certificate. + :paramtype thumbprint: str + :keyword subject: Required. Subject of the certificate. + :paramtype subject: str + """ super(CertificateInformation, self).__init__(**kwargs) self.expiry = expiry self.thumbprint = thumbprint @@ -5337,8 +7468,8 @@ def __init__( class ClientSecretContract(msrest.serialization.Model): """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - :param client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - :type client_secret: str + :ivar client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + :vartype client_secret: str """ _attribute_map = { @@ -5351,123 +7482,523 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword client_secret: Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + :paramtype client_secret: str + """ super(ClientSecretContract, self).__init__(**kwargs) self.client_secret = client_secret -class ConnectivityStatusContract(msrest.serialization.Model): - """Details about connectivity to a resource. +class ConnectivityCheckRequest(msrest.serialization.Model): + """A request to perform the connectivity check operation on a API Management service. All required parameters must be populated in order to send to Azure. - :param name: Required. The hostname of the resource which the service depends on. This can be - the database, storage or any other azure resource on which the service depends upon. - :type name: str - :param status: Required. Resource Connectivity Status Type identifier. Possible values include: - "initializing", "success", "failure". - :type status: str or ~azure.mgmt.apimanagement.models.ConnectivityStatusType - :param error: Error details of the connectivity to the resource. - :type error: str - :param last_updated: Required. The date when the resource connectivity status was last updated. - This status should be updated every 15 minutes. If this status has not been updated, then it - means that the service has lost network connectivity to the resource, from inside the Virtual - Network.The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the - ISO 8601 standard. - :type last_updated: ~datetime.datetime - :param last_status_change: Required. The date when the resource connectivity status last - Changed from success to failure or vice-versa. The date conforms to the following format: - ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type last_status_change: ~datetime.datetime - :param resource_type: Required. Resource Type. - :type resource_type: str - :param is_optional: Required. Whether this is optional. - :type is_optional: bool + :ivar source: Required. Definitions about the connectivity check origin. + :vartype source: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestSource + :ivar destination: Required. The connectivity check operation destination. + :vartype destination: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestDestination + :ivar preferred_ip_version: The IP version to be used. Only IPv4 is supported for now. Possible + values include: "IPv4". + :vartype preferred_ip_version: str or ~azure.mgmt.apimanagement.models.PreferredIPVersion + :ivar protocol: The request's protocol. Specific protocol configuration can be available based + on this selection. The specified destination address must be coherent with this value. Possible + values include: "TCP", "HTTP", "HTTPS". + :vartype protocol: str or ~azure.mgmt.apimanagement.models.ConnectivityCheckProtocol + :ivar protocol_configuration: Protocol-specific configuration. + :vartype protocol_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfiguration """ _validation = { - 'name': {'required': True, 'min_length': 1}, - 'status': {'required': True}, - 'last_updated': {'required': True}, - 'last_status_change': {'required': True}, - 'resource_type': {'required': True}, - 'is_optional': {'required': True}, + 'source': {'required': True}, + 'destination': {'required': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'str'}, - 'last_updated': {'key': 'lastUpdated', 'type': 'iso-8601'}, - 'last_status_change': {'key': 'lastStatusChange', 'type': 'iso-8601'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'is_optional': {'key': 'isOptional', 'type': 'bool'}, + 'source': {'key': 'source', 'type': 'ConnectivityCheckRequestSource'}, + 'destination': {'key': 'destination', 'type': 'ConnectivityCheckRequestDestination'}, + 'preferred_ip_version': {'key': 'preferredIPVersion', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'protocol_configuration': {'key': 'protocolConfiguration', 'type': 'ConnectivityCheckRequestProtocolConfiguration'}, } def __init__( self, *, - name: str, - status: Union[str, "ConnectivityStatusType"], - last_updated: datetime.datetime, - last_status_change: datetime.datetime, - resource_type: str, - is_optional: bool, - error: Optional[str] = None, - **kwargs - ): - super(ConnectivityStatusContract, self).__init__(**kwargs) - self.name = name - self.status = status - self.error = error - self.last_updated = last_updated - self.last_status_change = last_status_change - self.resource_type = resource_type - self.is_optional = is_optional + source: "ConnectivityCheckRequestSource", + destination: "ConnectivityCheckRequestDestination", + preferred_ip_version: Optional[Union[str, "PreferredIPVersion"]] = None, + protocol: Optional[Union[str, "ConnectivityCheckProtocol"]] = None, + protocol_configuration: Optional["ConnectivityCheckRequestProtocolConfiguration"] = None, + **kwargs + ): + """ + :keyword source: Required. Definitions about the connectivity check origin. + :paramtype source: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestSource + :keyword destination: Required. The connectivity check operation destination. + :paramtype destination: ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestDestination + :keyword preferred_ip_version: The IP version to be used. Only IPv4 is supported for now. + Possible values include: "IPv4". + :paramtype preferred_ip_version: str or ~azure.mgmt.apimanagement.models.PreferredIPVersion + :keyword protocol: The request's protocol. Specific protocol configuration can be available + based on this selection. The specified destination address must be coherent with this value. + Possible values include: "TCP", "HTTP", "HTTPS". + :paramtype protocol: str or ~azure.mgmt.apimanagement.models.ConnectivityCheckProtocol + :keyword protocol_configuration: Protocol-specific configuration. + :paramtype protocol_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfiguration + """ + super(ConnectivityCheckRequest, self).__init__(**kwargs) + self.source = source + self.destination = destination + self.preferred_ip_version = preferred_ip_version + self.protocol = protocol + self.protocol_configuration = protocol_configuration -class ContentItemCollection(msrest.serialization.Model): - """Paged list of content items. +class ConnectivityCheckRequestDestination(msrest.serialization.Model): + """The connectivity check operation destination. - 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 value: Collection of content items. - :vartype value: list[~azure.mgmt.apimanagement.models.ContentItemContract] - :ivar next_link: Next page link, if any. - :vartype next_link: str + :ivar address: Required. Destination address. Can either be an IP address or a FQDN. + :vartype address: str + :ivar port: Required. Destination port. + :vartype port: long """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'address': {'required': True}, + 'port': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ContentItemContract]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'long'}, } def __init__( self, + *, + address: str, + port: int, **kwargs ): - super(ContentItemCollection, self).__init__(**kwargs) - self.value = None - self.next_link = None + """ + :keyword address: Required. Destination address. Can either be an IP address or a FQDN. + :paramtype address: str + :keyword port: Required. Destination port. + :paramtype port: long + """ + super(ConnectivityCheckRequestDestination, self).__init__(**kwargs) + self.address = address + self.port = port -class ContentItemContract(Resource): - """Content type contract details. +class ConnectivityCheckRequestProtocolConfiguration(msrest.serialization.Model): + """Protocol-specific configuration. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar http_configuration: Configuration for HTTP or HTTPS requests. + :vartype http_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration + """ - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. + _attribute_map = { + 'http_configuration': {'key': 'HTTPConfiguration', 'type': 'ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration'}, + } + + def __init__( + self, + *, + http_configuration: Optional["ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration"] = None, + **kwargs + ): + """ + :keyword http_configuration: Configuration for HTTP or HTTPS requests. + :paramtype http_configuration: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration + """ + super(ConnectivityCheckRequestProtocolConfiguration, self).__init__(**kwargs) + self.http_configuration = http_configuration + + +class ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration(msrest.serialization.Model): + """Configuration for HTTP or HTTPS requests. + + :ivar method: The HTTP method to be used. Possible values include: "GET", "POST". + :vartype method: str or ~azure.mgmt.apimanagement.models.Method + :ivar valid_status_codes: List of HTTP status codes considered valid for the request response. + :vartype valid_status_codes: list[long] + :ivar headers: List of headers to be included in the request. + :vartype headers: list[~azure.mgmt.apimanagement.models.HTTPHeader] + """ + + _attribute_map = { + 'method': {'key': 'method', 'type': 'str'}, + 'valid_status_codes': {'key': 'validStatusCodes', 'type': '[long]'}, + 'headers': {'key': 'headers', 'type': '[HTTPHeader]'}, + } + + def __init__( + self, + *, + method: Optional[Union[str, "Method"]] = None, + valid_status_codes: Optional[List[int]] = None, + headers: Optional[List["HTTPHeader"]] = None, + **kwargs + ): + """ + :keyword method: The HTTP method to be used. Possible values include: "GET", "POST". + :paramtype method: str or ~azure.mgmt.apimanagement.models.Method + :keyword valid_status_codes: List of HTTP status codes considered valid for the request + response. + :paramtype valid_status_codes: list[long] + :keyword headers: List of headers to be included in the request. + :paramtype headers: list[~azure.mgmt.apimanagement.models.HTTPHeader] + """ + super(ConnectivityCheckRequestProtocolConfigurationHTTPConfiguration, self).__init__(**kwargs) + self.method = method + self.valid_status_codes = valid_status_codes + self.headers = headers + + +class ConnectivityCheckRequestSource(msrest.serialization.Model): + """Definitions about the connectivity check origin. + + All required parameters must be populated in order to send to Azure. + + :ivar region: Required. The API Management service region from where to start the connectivity + check operation. + :vartype region: str + :ivar instance: The particular VMSS instance from which to fire the request. + :vartype instance: long + """ + + _validation = { + 'region': {'required': True}, + } + + _attribute_map = { + 'region': {'key': 'region', 'type': 'str'}, + 'instance': {'key': 'instance', 'type': 'long'}, + } + + def __init__( + self, + *, + region: str, + instance: Optional[int] = None, + **kwargs + ): + """ + :keyword region: Required. The API Management service region from where to start the + connectivity check operation. + :paramtype region: str + :keyword instance: The particular VMSS instance from which to fire the request. + :paramtype instance: long + """ + super(ConnectivityCheckRequestSource, self).__init__(**kwargs) + self.region = region + self.instance = instance + + +class ConnectivityCheckResponse(msrest.serialization.Model): + """Information on the connectivity status. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar hops: List of hops between the source and the destination. + :vartype hops: list[~azure.mgmt.apimanagement.models.ConnectivityHop] + :ivar connection_status: The connection status. Possible values include: "Unknown", + "Connected", "Disconnected", "Degraded". + :vartype connection_status: str or ~azure.mgmt.apimanagement.models.ConnectionStatus + :ivar avg_latency_in_ms: Average latency in milliseconds. + :vartype avg_latency_in_ms: long + :ivar min_latency_in_ms: Minimum latency in milliseconds. + :vartype min_latency_in_ms: long + :ivar max_latency_in_ms: Maximum latency in milliseconds. + :vartype max_latency_in_ms: long + :ivar probes_sent: Total number of probes sent. + :vartype probes_sent: long + :ivar probes_failed: Number of failed probes. + :vartype probes_failed: long + """ + + _validation = { + 'hops': {'readonly': True}, + 'connection_status': {'readonly': True}, + 'avg_latency_in_ms': {'readonly': True}, + 'min_latency_in_ms': {'readonly': True}, + 'max_latency_in_ms': {'readonly': True}, + 'probes_sent': {'readonly': True}, + 'probes_failed': {'readonly': True}, + } + + _attribute_map = { + 'hops': {'key': 'hops', 'type': '[ConnectivityHop]'}, + 'connection_status': {'key': 'connectionStatus', 'type': 'str'}, + 'avg_latency_in_ms': {'key': 'avgLatencyInMs', 'type': 'long'}, + 'min_latency_in_ms': {'key': 'minLatencyInMs', 'type': 'long'}, + 'max_latency_in_ms': {'key': 'maxLatencyInMs', 'type': 'long'}, + 'probes_sent': {'key': 'probesSent', 'type': 'long'}, + 'probes_failed': {'key': 'probesFailed', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConnectivityCheckResponse, self).__init__(**kwargs) + self.hops = None + self.connection_status = None + self.avg_latency_in_ms = None + self.min_latency_in_ms = None + self.max_latency_in_ms = None + self.probes_sent = None + self.probes_failed = None + + +class ConnectivityHop(msrest.serialization.Model): + """Information about a hop between the source and the destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the hop. + :vartype type: str + :ivar id: The ID of the hop. + :vartype id: str + :ivar address: The IP address of the hop. + :vartype address: str + :ivar resource_id: The ID of the resource corresponding to this hop. + :vartype resource_id: str + :ivar next_hop_ids: List of next hop identifiers. + :vartype next_hop_ids: list[str] + :ivar issues: List of issues. + :vartype issues: list[~azure.mgmt.apimanagement.models.ConnectivityIssue] + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'address': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'next_hop_ids': {'readonly': True}, + 'issues': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'next_hop_ids': {'key': 'nextHopIds', 'type': '[str]'}, + 'issues': {'key': 'issues', 'type': '[ConnectivityIssue]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConnectivityHop, self).__init__(**kwargs) + self.type = None + self.id = None + self.address = None + self.resource_id = None + self.next_hop_ids = None + self.issues = None + + +class ConnectivityIssue(msrest.serialization.Model): + """Information about an issue encountered in the process of checking for connectivity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the issue. Possible values include: "Local", "Inbound", "Outbound". + :vartype origin: str or ~azure.mgmt.apimanagement.models.Origin + :ivar severity: The severity of the issue. Possible values include: "Error", "Warning". + :vartype severity: str or ~azure.mgmt.apimanagement.models.Severity + :ivar type: The type of issue. Possible values include: "Unknown", "AgentStopped", + "GuestFirewall", "DnsResolution", "SocketBind", "NetworkSecurityRule", "UserDefinedRoute", + "PortThrottled", "Platform". + :vartype type: str or ~azure.mgmt.apimanagement.models.IssueType + :ivar context: Provides additional context on the issue. + :vartype context: list[dict[str, str]] + """ + + _validation = { + 'origin': {'readonly': True}, + 'severity': {'readonly': True}, + 'type': {'readonly': True}, + 'context': {'readonly': True}, + } + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'context': {'key': 'context', 'type': '[{str}]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConnectivityIssue, self).__init__(**kwargs) + self.origin = None + self.severity = None + self.type = None + self.context = None + + +class ConnectivityStatusContract(msrest.serialization.Model): + """Details about connectivity to a resource. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The hostname of the resource which the service depends on. This can be + the database, storage or any other azure resource on which the service depends upon. + :vartype name: str + :ivar status: Required. Resource Connectivity Status Type identifier. Possible values include: + "initializing", "success", "failure". + :vartype status: str or ~azure.mgmt.apimanagement.models.ConnectivityStatusType + :ivar error: Error details of the connectivity to the resource. + :vartype error: str + :ivar last_updated: Required. The date when the resource connectivity status was last updated. + This status should be updated every 15 minutes. If this status has not been updated, then it + means that the service has lost network connectivity to the resource, from inside the Virtual + Network.The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the + ISO 8601 standard. + :vartype last_updated: ~datetime.datetime + :ivar last_status_change: Required. The date when the resource connectivity status last Changed + from success to failure or vice-versa. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype last_status_change: ~datetime.datetime + :ivar resource_type: Required. Resource Type. + :vartype resource_type: str + :ivar is_optional: Required. Whether this is optional. + :vartype is_optional: bool + """ + + _validation = { + 'name': {'required': True, 'min_length': 1}, + 'status': {'required': True}, + 'last_updated': {'required': True}, + 'last_status_change': {'required': True}, + 'resource_type': {'required': True}, + 'is_optional': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'last_updated': {'key': 'lastUpdated', 'type': 'iso-8601'}, + 'last_status_change': {'key': 'lastStatusChange', 'type': 'iso-8601'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'is_optional': {'key': 'isOptional', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + status: Union[str, "ConnectivityStatusType"], + last_updated: datetime.datetime, + last_status_change: datetime.datetime, + resource_type: str, + is_optional: bool, + error: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The hostname of the resource which the service depends on. This can be + the database, storage or any other azure resource on which the service depends upon. + :paramtype name: str + :keyword status: Required. Resource Connectivity Status Type identifier. Possible values + include: "initializing", "success", "failure". + :paramtype status: str or ~azure.mgmt.apimanagement.models.ConnectivityStatusType + :keyword error: Error details of the connectivity to the resource. + :paramtype error: str + :keyword last_updated: Required. The date when the resource connectivity status was last + updated. This status should be updated every 15 minutes. If this status has not been updated, + then it means that the service has lost network connectivity to the resource, from inside the + Virtual Network.The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as + specified by the ISO 8601 standard. + :paramtype last_updated: ~datetime.datetime + :keyword last_status_change: Required. The date when the resource connectivity status last + Changed from success to failure or vice-versa. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype last_status_change: ~datetime.datetime + :keyword resource_type: Required. Resource Type. + :paramtype resource_type: str + :keyword is_optional: Required. Whether this is optional. + :paramtype is_optional: bool + """ + super(ConnectivityStatusContract, self).__init__(**kwargs) + self.name = name + self.status = status + self.error = error + self.last_updated = last_updated + self.last_status_change = last_status_change + self.resource_type = resource_type + self.is_optional = is_optional + + +class ContentItemCollection(msrest.serialization.Model): + """Paged list of content items. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of content items. + :vartype value: list[~azure.mgmt.apimanagement.models.ContentItemContract] + :ivar next_link: Next page link, if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContentItemContract]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ContentItemCollection, self).__init__(**kwargs) + self.value = None + self.next_link = 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: 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: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param properties: Properties of the content item. - :type properties: dict[str, any] + :ivar properties: Properties of the content item. + :vartype properties: dict[str, any] """ _validation = { @@ -5489,6 +8020,10 @@ def __init__( properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword properties: Properties of the content item. + :paramtype properties: dict[str, any] + """ super(ContentItemContract, self).__init__(**kwargs) self.properties = properties @@ -5518,6 +8053,8 @@ def __init__( self, **kwargs ): + """ + """ super(ContentTypeCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5528,22 +8065,24 @@ class ContentTypeContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param id_properties_id: Content type identifier. - :type id_properties_id: str - :param name_properties_name: Content type name. Must be 1 to 250 characters long. - :type name_properties_name: str - :param description: Content type description. - :type description: str - :param schema: Content type schema. - :type schema: any - :param version: Content type version. - :type version: str + :ivar id_properties_id: Content type identifier. + :vartype id_properties_id: str + :ivar name_properties_name: Content type name. Must be 1 to 250 characters long. + :vartype name_properties_name: str + :ivar description: Content type description. + :vartype description: str + :ivar schema: Content type schema. + :vartype schema: any + :ivar version: Content type version. + :vartype version: str """ _validation = { @@ -5573,6 +8112,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id_properties_id: Content type identifier. + :paramtype id_properties_id: str + :keyword name_properties_name: Content type name. Must be 1 to 250 characters long. + :paramtype name_properties_name: str + :keyword description: Content type description. + :paramtype description: str + :keyword schema: Content type schema. + :paramtype schema: any + :keyword version: Content type version. + :paramtype version: str + """ super(ContentTypeContract, self).__init__(**kwargs) self.id_properties_id = id_properties_id self.name_properties_name = name_properties_name @@ -5584,10 +8135,10 @@ def __init__( class DataMasking(msrest.serialization.Model): """DataMasking. - :param query_params: Masking settings for Url query parameters. - :type query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] - :param headers: Masking settings for headers. - :type headers: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + :ivar query_params: Masking settings for Url query parameters. + :vartype query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + :ivar headers: Masking settings for headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] """ _attribute_map = { @@ -5602,6 +8153,12 @@ def __init__( headers: Optional[List["DataMaskingEntity"]] = None, **kwargs ): + """ + :keyword query_params: Masking settings for Url query parameters. + :paramtype query_params: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + :keyword headers: Masking settings for headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.DataMaskingEntity] + """ super(DataMasking, self).__init__(**kwargs) self.query_params = query_params self.headers = headers @@ -5610,10 +8167,10 @@ def __init__( class DataMaskingEntity(msrest.serialization.Model): """DataMaskingEntity. - :param value: The name of an entity to mask (e.g. a name of a header or a query parameter). - :type value: str - :param mode: Data masking mode. Possible values include: "Mask", "Hide". - :type mode: str or ~azure.mgmt.apimanagement.models.DataMaskingMode + :ivar value: The name of an entity to mask (e.g. a name of a header or a query parameter). + :vartype value: str + :ivar mode: Data masking mode. Possible values include: "Mask", "Hide". + :vartype mode: str or ~azure.mgmt.apimanagement.models.DataMaskingMode """ _attribute_map = { @@ -5628,33 +8185,41 @@ def __init__( mode: Optional[Union[str, "DataMaskingMode"]] = None, **kwargs ): + """ + :keyword value: The name of an entity to mask (e.g. a name of a header or a query parameter). + :paramtype value: str + :keyword mode: Data masking mode. Possible values include: "Mask", "Hide". + :paramtype mode: str or ~azure.mgmt.apimanagement.models.DataMaskingMode + """ super(DataMaskingEntity, self).__init__(**kwargs) self.value = value self.mode = mode class DeletedServiceContract(Resource): - """Deleted Api Management Service information. + """Deleted API Management Service information. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Api Management Service Master Location. + :ivar location: API Management Service Master Location. :vartype location: str - :param service_id: Fully-qualified API Management Service Resource ID. - :type service_id: str - :param scheduled_purge_date: UTC Date and Time when the service will be automatically purged. + :ivar service_id: Fully-qualified API Management Service Resource ID. + :vartype service_id: str + :ivar scheduled_purge_date: UTC Date and Time when the service will be automatically purged. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :type scheduled_purge_date: ~datetime.datetime - :param deletion_date: UTC Timestamp when the service was soft-deleted. The date conforms to the + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deletion_date: UTC Timestamp when the service was soft-deleted. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. - :type deletion_date: ~datetime.datetime + :vartype deletion_date: ~datetime.datetime """ _validation = { @@ -5682,6 +8247,17 @@ def __init__( deletion_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword service_id: Fully-qualified API Management Service Resource ID. + :paramtype service_id: str + :keyword scheduled_purge_date: UTC Date and Time when the service will be automatically purged. + The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 + standard. + :paramtype scheduled_purge_date: ~datetime.datetime + :keyword deletion_date: UTC Timestamp when the service was soft-deleted. The date conforms to + the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + :paramtype deletion_date: ~datetime.datetime + """ super(DeletedServiceContract, self).__init__(**kwargs) self.location = None self.service_id = service_id @@ -5690,7 +8266,7 @@ def __init__( class DeletedServicesCollection(msrest.serialization.Model): - """Paged deleted Api Management Services List Representation. + """Paged deleted API Management Services List Representation. Variables are only populated by the server, and will be ignored when sending a request. @@ -5714,6 +8290,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedServicesCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5722,12 +8300,12 @@ def __init__( class DeployConfigurationParameters(msrest.serialization.Model): """Deploy Tenant Configuration Contract. - :param branch: The name of the Git branch from which the configuration is to be deployed to the + :ivar branch: The name of the Git branch from which the configuration is to be deployed to the configuration database. - :type branch: str - :param force: The value enforcing deleting subscriptions to products that are deleted in this + :vartype branch: str + :ivar force: The value enforcing deleting subscriptions to products that are deleted in this update. - :type force: bool + :vartype force: bool """ _attribute_map = { @@ -5742,6 +8320,14 @@ def __init__( force: Optional[bool] = None, **kwargs ): + """ + :keyword branch: The name of the Git branch from which the configuration is to be deployed to + the configuration database. + :paramtype branch: str + :keyword force: The value enforcing deleting subscriptions to products that are deleted in this + update. + :paramtype force: bool + """ super(DeployConfigurationParameters, self).__init__(**kwargs) self.branch = branch self.force = force @@ -5750,12 +8336,12 @@ def __init__( class DiagnosticCollection(msrest.serialization.Model): """Paged Diagnostic list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5772,6 +8358,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.DiagnosticContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(DiagnosticCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -5783,35 +8377,37 @@ class DiagnosticContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param always_log: Specifies for what type of messages sampling settings should not apply. + :ivar always_log: Specifies for what type of messages sampling settings should not apply. Possible values include: "allErrors". - :type always_log: str or ~azure.mgmt.apimanagement.models.AlwaysLog - :param logger_id: Resource Id of a target logger. - :type logger_id: str - :param sampling: Sampling settings for Diagnostic. - :type sampling: ~azure.mgmt.apimanagement.models.SamplingSettings - :param frontend: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - :type frontend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings - :param backend: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. - :type backend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings - :param log_client_ip: Log the ClientIP. Default is false. - :type log_client_ip: bool - :param http_correlation_protocol: Sets correlation protocol to use for Application Insights + :vartype always_log: str or ~azure.mgmt.apimanagement.models.AlwaysLog + :ivar logger_id: Resource Id of a target logger. + :vartype logger_id: str + :ivar sampling: Sampling settings for Diagnostic. + :vartype sampling: ~azure.mgmt.apimanagement.models.SamplingSettings + :ivar frontend: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + :vartype frontend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :ivar backend: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. + :vartype backend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :ivar log_client_ip: Log the ClientIP. Default is false. + :vartype log_client_ip: bool + :ivar http_correlation_protocol: Sets correlation protocol to use for Application Insights diagnostics. Possible values include: "None", "Legacy", "W3C". - :type http_correlation_protocol: str or + :vartype http_correlation_protocol: str or ~azure.mgmt.apimanagement.models.HttpCorrelationProtocol - :param verbosity: The verbosity level applied to traces emitted by trace policies. Possible + :ivar verbosity: The verbosity level applied to traces emitted by trace policies. Possible values include: "verbose", "information", "error". - :type verbosity: str or ~azure.mgmt.apimanagement.models.Verbosity - :param operation_name_format: The format of the Operation Name for Application Insights + :vartype verbosity: str or ~azure.mgmt.apimanagement.models.Verbosity + :ivar operation_name_format: The format of the Operation Name for Application Insights telemetries. Default is Name. Possible values include: "Name", "Url". - :type operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat + :vartype operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat """ _validation = { @@ -5849,6 +8445,31 @@ def __init__( operation_name_format: Optional[Union[str, "OperationNameFormat"]] = None, **kwargs ): + """ + :keyword always_log: Specifies for what type of messages sampling settings should not apply. + Possible values include: "allErrors". + :paramtype always_log: str or ~azure.mgmt.apimanagement.models.AlwaysLog + :keyword logger_id: Resource Id of a target logger. + :paramtype logger_id: str + :keyword sampling: Sampling settings for Diagnostic. + :paramtype sampling: ~azure.mgmt.apimanagement.models.SamplingSettings + :keyword frontend: Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. + :paramtype frontend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :keyword backend: Diagnostic settings for incoming/outgoing HTTP messages to the Backend. + :paramtype backend: ~azure.mgmt.apimanagement.models.PipelineDiagnosticSettings + :keyword log_client_ip: Log the ClientIP. Default is false. + :paramtype log_client_ip: bool + :keyword http_correlation_protocol: Sets correlation protocol to use for Application Insights + diagnostics. Possible values include: "None", "Legacy", "W3C". + :paramtype http_correlation_protocol: str or + ~azure.mgmt.apimanagement.models.HttpCorrelationProtocol + :keyword verbosity: The verbosity level applied to traces emitted by trace policies. Possible + values include: "verbose", "information", "error". + :paramtype verbosity: str or ~azure.mgmt.apimanagement.models.Verbosity + :keyword operation_name_format: The format of the Operation Name for Application Insights + telemetries. Default is Name. Possible values include: "Name", "Url". + :paramtype operation_name_format: str or ~azure.mgmt.apimanagement.models.OperationNameFormat + """ super(DiagnosticContract, self).__init__(**kwargs) self.always_log = always_log self.logger_id = logger_id @@ -5864,12 +8485,12 @@ def __init__( class EmailTemplateCollection(msrest.serialization.Model): """Paged email template list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -5886,6 +8507,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.EmailTemplateContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(EmailTemplateCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -5897,25 +8526,27 @@ class EmailTemplateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param subject: Subject of the Template. - :type subject: str - :param body: Email Template Body. This should be a valid XDocument. - :type body: str - :param title: Title of the Template. - :type title: str - :param description: Description of the Email Template. - :type description: str - :ivar is_default: Whether the template is the default template provided by Api Management or + :ivar subject: Subject of the Template. + :vartype subject: str + :ivar body: Email Template Body. This should be a valid XDocument. + :vartype body: str + :ivar title: Title of the Template. + :vartype title: str + :ivar description: Description of the Email Template. + :vartype description: str + :ivar is_default: Whether the template is the default template provided by API Management or has been edited. :vartype is_default: bool - :param parameters: Email Template Parameter values. - :type parameters: + :ivar parameters: Email Template Parameter values. + :vartype parameters: list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] """ @@ -5950,6 +8581,19 @@ def __init__( parameters: Optional[List["EmailTemplateParametersContractProperties"]] = None, **kwargs ): + """ + :keyword subject: Subject of the Template. + :paramtype subject: str + :keyword body: Email Template Body. This should be a valid XDocument. + :paramtype body: str + :keyword title: Title of the Template. + :paramtype title: str + :keyword description: Description of the Email Template. + :paramtype description: str + :keyword parameters: Email Template Parameter values. + :paramtype parameters: + list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] + """ super(EmailTemplateContract, self).__init__(**kwargs) self.subject = subject self.body = body @@ -5962,12 +8606,12 @@ def __init__( class EmailTemplateParametersContractProperties(msrest.serialization.Model): """Email Template Parameter contract. - :param name: Template parameter name. - :type name: str - :param title: Template parameter title. - :type title: str - :param description: Template parameter description. - :type description: str + :ivar name: Template parameter name. + :vartype name: str + :ivar title: Template parameter title. + :vartype title: str + :ivar description: Template parameter description. + :vartype description: str """ _validation = { @@ -5990,6 +8634,14 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword name: Template parameter name. + :paramtype name: str + :keyword title: Template parameter title. + :paramtype title: str + :keyword description: Template parameter description. + :paramtype description: str + """ super(EmailTemplateParametersContractProperties, self).__init__(**kwargs) self.name = name self.title = title @@ -5999,16 +8651,16 @@ def __init__( class EmailTemplateUpdateParameters(msrest.serialization.Model): """Email Template update Parameters. - :param subject: Subject of the Template. - :type subject: str - :param title: Title of the Template. - :type title: str - :param description: Description of the Email Template. - :type description: str - :param body: Email Template Body. This should be a valid XDocument. - :type body: str - :param parameters: Email Template Parameter values. - :type parameters: + :ivar subject: Subject of the Template. + :vartype subject: str + :ivar title: Title of the Template. + :vartype title: str + :ivar description: Description of the Email Template. + :vartype description: str + :ivar body: Email Template Body. This should be a valid XDocument. + :vartype body: str + :ivar parameters: Email Template Parameter values. + :vartype parameters: list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] """ @@ -6035,6 +8687,19 @@ def __init__( parameters: Optional[List["EmailTemplateParametersContractProperties"]] = None, **kwargs ): + """ + :keyword subject: Subject of the Template. + :paramtype subject: str + :keyword title: Title of the Template. + :paramtype title: str + :keyword description: Description of the Email Template. + :paramtype description: str + :keyword body: Email Template Body. This should be a valid XDocument. + :paramtype body: str + :keyword parameters: Email Template Parameter values. + :paramtype parameters: + list[~azure.mgmt.apimanagement.models.EmailTemplateParametersContractProperties] + """ super(EmailTemplateUpdateParameters, self).__init__(**kwargs) self.subject = subject self.title = title @@ -6043,15 +8708,79 @@ def __init__( self.parameters = parameters +class EndpointDependency(msrest.serialization.Model): + """A domain name that a service is reached at. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports used when connecting to DomainName. + :vartype endpoint_details: list[~azure.mgmt.apimanagement.models.EndpointDetail] + """ + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["EndpointDetail"]] = None, + **kwargs + ): + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports used when connecting to DomainName. + :paramtype endpoint_details: list[~azure.mgmt.apimanagement.models.EndpointDetail] + """ + super(EndpointDependency, self).__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(msrest.serialization.Model): + """Current TCP connectivity information from the Api Management Service to a single endpoint. + + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar region: The region of the dependency. + :vartype region: str + """ + + _attribute_map = { + 'port': {'key': 'port', 'type': 'int'}, + 'region': {'key': 'region', 'type': 'str'}, + } + + def __init__( + self, + *, + port: Optional[int] = None, + region: Optional[str] = None, + **kwargs + ): + """ + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword region: The region of the dependency. + :paramtype region: str + """ + super(EndpointDetail, self).__init__(**kwargs) + self.port = port + self.region = region + + class ErrorFieldContract(msrest.serialization.Model): """Error Field contract. - :param code: Property level error code. - :type code: str - :param message: Human-readable representation of property-level error. - :type message: str - :param target: Property name. - :type target: str + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str """ _attribute_map = { @@ -6068,6 +8797,14 @@ def __init__( target: Optional[str] = None, **kwargs ): + """ + :keyword code: Property level error code. + :paramtype code: str + :keyword message: Human-readable representation of property-level error. + :paramtype message: str + :keyword target: Property name. + :paramtype target: str + """ super(ErrorFieldContract, self).__init__(**kwargs) self.code = code self.message = message @@ -6077,13 +8814,13 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Error Response. - :param code: Service-defined error code. This code serves as a sub-status for the HTTP error + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - :type code: str - :param message: Human-readable representation of the error. - :type message: str - :param details: The list of invalid fields send in request, in case of validation error. - :type details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] """ _attribute_map = { @@ -6100,6 +8837,15 @@ def __init__( details: Optional[List["ErrorFieldContract"]] = None, **kwargs ): + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + """ super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message @@ -6109,13 +8855,13 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """Error Body contract. - :param code: Service-defined error code. This code serves as a sub-status for the HTTP error + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - :type code: str - :param message: Human-readable representation of the error. - :type message: str - :param details: The list of invalid fields send in request, in case of validation error. - :type details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] """ _attribute_map = { @@ -6132,6 +8878,15 @@ def __init__( details: Optional[List["ErrorFieldContract"]] = None, **kwargs ): + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: list[~azure.mgmt.apimanagement.models.ErrorFieldContract] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -6163,6 +8918,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayCertificateAuthorityCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -6173,14 +8930,16 @@ class GatewayCertificateAuthorityContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param is_trusted: Determines whether certificate authority is trusted. - :type is_trusted: bool + :ivar is_trusted: Determines whether certificate authority is trusted. + :vartype is_trusted: bool """ _validation = { @@ -6202,6 +8961,10 @@ def __init__( is_trusted: Optional[bool] = None, **kwargs ): + """ + :keyword is_trusted: Determines whether certificate authority is trusted. + :paramtype is_trusted: bool + """ super(GatewayCertificateAuthorityContract, self).__init__(**kwargs) self.is_trusted = is_trusted @@ -6213,8 +8976,8 @@ class GatewayCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.GatewayContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -6236,6 +8999,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(GatewayCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -6247,16 +9014,18 @@ class GatewayContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location_data: Gateway location. - :type location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract - :param description: Gateway description. - :type description: str + :ivar location_data: Gateway location. + :vartype location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract + :ivar description: Gateway description. + :vartype description: str """ _validation = { @@ -6281,6 +9050,12 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword location_data: Gateway location. + :paramtype location_data: ~azure.mgmt.apimanagement.models.ResourceLocationDataContract + :keyword description: Gateway description. + :paramtype description: str + """ super(GatewayContract, self).__init__(**kwargs) self.location_data = location_data self.description = description @@ -6311,6 +9086,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayHostnameConfigurationCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -6321,25 +9098,27 @@ class GatewayHostnameConfigurationContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param hostname: Hostname value. Supports valid domain name, partial or full wildcard. - :type hostname: str - :param certificate_id: Identifier of Certificate entity that will be used for TLS connection + :ivar hostname: Hostname value. Supports valid domain name, partial or full wildcard. + :vartype hostname: str + :ivar certificate_id: Identifier of Certificate entity that will be used for TLS connection establishment. - :type certificate_id: str - :param negotiate_client_certificate: Determines whether gateway requests client certificate. - :type negotiate_client_certificate: bool - :param tls10_enabled: Specifies if TLS 1.0 is supported. - :type tls10_enabled: bool - :param tls11_enabled: Specifies if TLS 1.1 is supported. - :type tls11_enabled: bool - :param http2_enabled: Specifies if HTTP/2.0 is supported. - :type http2_enabled: bool + :vartype certificate_id: str + :ivar negotiate_client_certificate: Determines whether gateway requests client certificate. + :vartype negotiate_client_certificate: bool + :ivar tls10_enabled: Specifies if TLS 1.0 is supported. + :vartype tls10_enabled: bool + :ivar tls11_enabled: Specifies if TLS 1.1 is supported. + :vartype tls11_enabled: bool + :ivar http2_enabled: Specifies if HTTP/2.0 is supported. + :vartype http2_enabled: bool """ _validation = { @@ -6371,6 +9150,21 @@ def __init__( http2_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword hostname: Hostname value. Supports valid domain name, partial or full wildcard. + :paramtype hostname: str + :keyword certificate_id: Identifier of Certificate entity that will be used for TLS connection + establishment. + :paramtype certificate_id: str + :keyword negotiate_client_certificate: Determines whether gateway requests client certificate. + :paramtype negotiate_client_certificate: bool + :keyword tls10_enabled: Specifies if TLS 1.0 is supported. + :paramtype tls10_enabled: bool + :keyword tls11_enabled: Specifies if TLS 1.1 is supported. + :paramtype tls11_enabled: bool + :keyword http2_enabled: Specifies if HTTP/2.0 is supported. + :paramtype http2_enabled: bool + """ super(GatewayHostnameConfigurationContract, self).__init__(**kwargs) self.hostname = hostname self.certificate_id = certificate_id @@ -6385,9 +9179,9 @@ class GatewayKeyRegenerationRequestContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. The Key being regenerated. Possible values include: "primary", + :ivar key_type: Required. The Key being regenerated. Possible values include: "primary", "secondary". - :type key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :vartype key_type: str or ~azure.mgmt.apimanagement.models.KeyType """ _validation = { @@ -6404,6 +9198,11 @@ def __init__( key_type: Union[str, "KeyType"], **kwargs ): + """ + :keyword key_type: Required. The Key being regenerated. Possible values include: "primary", + "secondary". + :paramtype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + """ super(GatewayKeyRegenerationRequestContract, self).__init__(**kwargs) self.key_type = key_type @@ -6411,10 +9210,10 @@ def __init__( class GatewayKeysContract(msrest.serialization.Model): """Gateway authentication keys. - :param primary: Primary gateway key. - :type primary: str - :param secondary: Secondary gateway key. - :type secondary: str + :ivar primary: Primary gateway key. + :vartype primary: str + :ivar secondary: Secondary gateway key. + :vartype secondary: str """ _attribute_map = { @@ -6429,6 +9228,12 @@ def __init__( secondary: Optional[str] = None, **kwargs ): + """ + :keyword primary: Primary gateway key. + :paramtype primary: str + :keyword secondary: Secondary gateway key. + :paramtype secondary: str + """ super(GatewayKeysContract, self).__init__(**kwargs) self.primary = primary self.secondary = secondary @@ -6437,8 +9242,8 @@ def __init__( class GatewayTokenContract(msrest.serialization.Model): """Gateway access token. - :param value: Shared Access Authentication token value for the Gateway. - :type value: str + :ivar value: Shared Access Authentication token value for the Gateway. + :vartype value: str """ _attribute_map = { @@ -6451,6 +9256,10 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: Shared Access Authentication token value for the Gateway. + :paramtype value: str + """ super(GatewayTokenContract, self).__init__(**kwargs) self.value = value @@ -6460,13 +9269,13 @@ class GatewayTokenRequestContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. The Key to be used to generate gateway token. Possible values + :ivar key_type: Required. The Key to be used to generate gateway token. Possible values include: "primary", "secondary". - :type key_type: str or ~azure.mgmt.apimanagement.models.KeyType - :param expiry: Required. The Expiry time of the Token. Maximum token expiry time is set to 30 + :vartype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :ivar expiry: Required. The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiry: ~datetime.datetime + :vartype expiry: ~datetime.datetime """ _validation = { @@ -6486,6 +9295,15 @@ def __init__( expiry: datetime.datetime, **kwargs ): + """ + :keyword key_type: Required. The Key to be used to generate gateway token. Possible values + include: "primary", "secondary". + :paramtype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :keyword expiry: Required. The Expiry time of the Token. Maximum token expiry time is set to 30 + days. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the + ISO 8601 standard. + :paramtype expiry: ~datetime.datetime + """ super(GatewayTokenRequestContract, self).__init__(**kwargs) self.key_type = key_type self.expiry = expiry @@ -6494,8 +9312,8 @@ def __init__( class GenerateSsoUrlResult(msrest.serialization.Model): """Generate SSO Url operations response details. - :param value: Redirect Url containing the SSO URL value. - :type value: str + :ivar value: Redirect Url containing the SSO URL value. + :vartype value: str """ _attribute_map = { @@ -6508,19 +9326,129 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: Redirect Url containing the SSO URL value. + :paramtype value: str + """ super(GenerateSsoUrlResult, self).__init__(**kwargs) self.value = value +class GlobalSchemaCollection(msrest.serialization.Model): + """The response of the list schema operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Global Schema Contract value. + :vartype value: list[~azure.mgmt.apimanagement.models.GlobalSchemaContract] + :ivar count: Total record count number. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GlobalSchemaContract]'}, + 'count': {'key': 'count', 'type': 'long'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + **kwargs + ): + """ + :keyword count: Total record count number. + :paramtype count: long + """ + super(GlobalSchemaCollection, self).__init__(**kwargs) + self.value = None + self.count = count + self.next_link = None + + +class GlobalSchemaContract(Resource): + """Global Schema Contract details. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar schema_type: Schema Type. Immutable. Possible values include: "xml", "json". + :vartype schema_type: str or ~azure.mgmt.apimanagement.models.SchemaType + :ivar description: Free-form schema entity description. + :vartype description: str + :ivar value: Json-encoded string for non json-based schema. + :vartype value: any + :ivar document: Global Schema document object for json-based schema formats(e.g. json schema). + :vartype document: any + """ + + _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'}, + 'schema_type': {'key': 'properties.schemaType', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'object'}, + 'document': {'key': 'properties.document', 'type': 'object'}, + } + + def __init__( + self, + *, + schema_type: Optional[Union[str, "SchemaType"]] = None, + description: Optional[str] = None, + value: Optional[Any] = None, + document: Optional[Any] = None, + **kwargs + ): + """ + :keyword schema_type: Schema Type. Immutable. Possible values include: "xml", "json". + :paramtype schema_type: str or ~azure.mgmt.apimanagement.models.SchemaType + :keyword description: Free-form schema entity description. + :paramtype description: str + :keyword value: Json-encoded string for non json-based schema. + :paramtype value: any + :keyword document: Global Schema document object for json-based schema formats(e.g. json + schema). + :paramtype document: any + """ + super(GlobalSchemaContract, self).__init__(**kwargs) + self.schema_type = schema_type + self.description = description + self.value = value + self.document = document + + class GroupCollection(msrest.serialization.Model): """Paged Group list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.GroupContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.GroupContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -6537,6 +9465,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.GroupContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(GroupCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -6548,26 +9484,28 @@ class GroupContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param display_name: Group name. - :type display_name: str - :param description: Group description. Can contain HTML formatting tags. - :type description: str + :ivar display_name: Group name. + :vartype display_name: str + :ivar description: Group description. Can contain HTML formatting tags. + :vartype description: str :ivar built_in: true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. :vartype built_in: bool - :param type_properties_type: Group type. Possible values include: "custom", "system", + :ivar type_properties_type: Group type. Possible values include: "custom", "system", "external". - :type type_properties_type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: For external groups, this property contains the id of the group from the + :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -6599,6 +9537,19 @@ def __init__( external_id: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Group name. + :paramtype display_name: str + :keyword description: Group description. Can contain HTML formatting tags. + :paramtype description: str + :keyword type_properties_type: Group type. Possible values include: "custom", "system", + "external". + :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: For external groups, this property contains the id of the group from the + external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupContract, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -6614,19 +9565,19 @@ class GroupContractProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param display_name: Required. Group name. - :type display_name: str - :param description: Group description. Can contain HTML formatting tags. - :type description: str + :ivar display_name: Required. Group name. + :vartype display_name: str + :ivar description: Group description. Can contain HTML formatting tags. + :vartype description: str :ivar built_in: true if the group is one of the three system groups (Administrators, Developers, or Guests); otherwise false. :vartype built_in: bool - :param type: Group type. Possible values include: "custom", "system", "external". - :type type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: For external groups, this property contains the id of the group from the + :ivar type: Group type. Possible values include: "custom", "system", "external". + :vartype type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: For external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -6652,6 +9603,18 @@ def __init__( external_id: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Required. Group name. + :paramtype display_name: str + :keyword description: Group description. Can contain HTML formatting tags. + :paramtype description: str + :keyword type: Group type. Possible values include: "custom", "system", "external". + :paramtype type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: For external groups, this property contains the id of the group from the + external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupContractProperties, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -6663,16 +9626,16 @@ def __init__( class GroupCreateParameters(msrest.serialization.Model): """Parameters supplied to the Create Group operation. - :param display_name: Group name. - :type display_name: str - :param description: Group description. - :type description: str - :param type: Group type. Possible values include: "custom", "system", "external". - :type type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: Identifier of the external groups, this property contains the id of the + :ivar display_name: Group name. + :vartype display_name: str + :ivar description: Group description. + :vartype description: str + :ivar type: Group type. Possible values include: "custom", "system", "external". + :vartype type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -6695,6 +9658,18 @@ def __init__( external_id: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Group name. + :paramtype display_name: str + :keyword description: Group description. + :paramtype description: str + :keyword type: Group type. Possible values include: "custom", "system", "external". + :paramtype type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: Identifier of the external groups, this property contains the id of the + group from the external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupCreateParameters, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -6705,16 +9680,16 @@ def __init__( class GroupUpdateParameters(msrest.serialization.Model): """Parameters supplied to the Update Group operation. - :param display_name: Group name. - :type display_name: str - :param description: Group description. - :type description: str - :param type: Group type. Possible values include: "custom", "system", "external". - :type type: str or ~azure.mgmt.apimanagement.models.GroupType - :param external_id: Identifier of the external groups, this property contains the id of the + :ivar display_name: Group name. + :vartype display_name: str + :ivar description: Group description. + :vartype description: str + :ivar type: Group type. Possible values include: "custom", "system", "external". + :vartype type: str or ~azure.mgmt.apimanagement.models.GroupType + :ivar external_id: Identifier of the external groups, this property contains the id of the group from the external identity provider, e.g. for Azure Active Directory ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. - :type external_id: str + :vartype external_id: str """ _validation = { @@ -6737,6 +9712,18 @@ def __init__( external_id: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Group name. + :paramtype display_name: str + :keyword description: Group description. + :paramtype description: str + :keyword type: Group type. Possible values include: "custom", "system", "external". + :paramtype type: str or ~azure.mgmt.apimanagement.models.GroupType + :keyword external_id: Identifier of the external groups, this property contains the id of the + group from the external identity provider, e.g. for Azure Active Directory + ``aad://.onmicrosoft.com/groups/``\ ; otherwise the value is null. + :paramtype external_id: str + """ super(GroupUpdateParameters, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -6749,34 +9736,40 @@ class HostnameConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Hostname type. Possible values include: "Proxy", "Portal", "Management", + :ivar type: Required. Hostname type. Possible values include: "Proxy", "Portal", "Management", "Scm", "DeveloperPortal". - :type type: str or ~azure.mgmt.apimanagement.models.HostnameType - :param host_name: Required. Hostname to configure on the Api Management service. - :type host_name: str - :param key_vault_id: Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url + :vartype type: str or ~azure.mgmt.apimanagement.models.HostnameType + :ivar host_name: Required. Hostname to configure on the Api Management service. + :vartype host_name: str + :ivar key_vault_id: Url to the KeyVault Secret containing the Ssl Certificate. If absolute Url containing version is provided, auto-update of ssl certificate will not work. This requires Api Management service to be configured with aka.ms/apimmsi. The secret should be of type *application/x-pkcs12*. - :type key_vault_id: str - :param identity_client_id: System or User Assigned Managed identity clientId as generated by + :vartype key_vault_id: str + :ivar identity_client_id: System or User Assigned Managed identity clientId as generated by Azure AD, which has GET access to the keyVault containing the SSL certificate. - :type identity_client_id: str - :param encoded_certificate: Base64 Encoded certificate. - :type encoded_certificate: str - :param certificate_password: Certificate Password. - :type certificate_password: str - :param default_ssl_binding: Specify true to setup the certificate associated with this Hostname + :vartype identity_client_id: str + :ivar encoded_certificate: Base64 Encoded certificate. + :vartype encoded_certificate: str + :ivar certificate_password: Certificate Password. + :vartype certificate_password: str + :ivar default_ssl_binding: Specify true to setup the certificate associated with this Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this will be the certificate that will be challenged. The property is useful if a service has multiple custom hostname enabled and it needs to decide on the default ssl certificate. The setting only applied to Proxy Hostname Type. - :type default_ssl_binding: bool - :param negotiate_client_certificate: Specify true to always negotiate client certificate on the + :vartype default_ssl_binding: bool + :ivar negotiate_client_certificate: Specify true to always negotiate client certificate on the hostname. Default Value is false. - :type negotiate_client_certificate: bool - :param certificate: Certificate information. - :type certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :vartype negotiate_client_certificate: bool + :ivar certificate: Certificate information. + :vartype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :ivar certificate_source: Certificate Source. Possible values include: "Managed", "KeyVault", + "Custom", "BuiltIn". + :vartype certificate_source: str or ~azure.mgmt.apimanagement.models.CertificateSource + :ivar certificate_status: Certificate Status. Possible values include: "Completed", "Failed", + "InProgress". + :vartype certificate_status: str or ~azure.mgmt.apimanagement.models.CertificateStatus """ _validation = { @@ -6794,6 +9787,8 @@ class HostnameConfiguration(msrest.serialization.Model): 'default_ssl_binding': {'key': 'defaultSslBinding', 'type': 'bool'}, 'negotiate_client_certificate': {'key': 'negotiateClientCertificate', 'type': 'bool'}, 'certificate': {'key': 'certificate', 'type': 'CertificateInformation'}, + 'certificate_source': {'key': 'certificateSource', 'type': 'str'}, + 'certificate_status': {'key': 'certificateStatus', 'type': 'str'}, } def __init__( @@ -6808,8 +9803,46 @@ def __init__( default_ssl_binding: Optional[bool] = False, negotiate_client_certificate: Optional[bool] = False, certificate: Optional["CertificateInformation"] = None, - **kwargs - ): + certificate_source: Optional[Union[str, "CertificateSource"]] = None, + certificate_status: Optional[Union[str, "CertificateStatus"]] = None, + **kwargs + ): + """ + :keyword type: Required. Hostname type. Possible values include: "Proxy", "Portal", + "Management", "Scm", "DeveloperPortal". + :paramtype type: str or ~azure.mgmt.apimanagement.models.HostnameType + :keyword host_name: Required. Hostname to configure on the Api Management service. + :paramtype host_name: str + :keyword key_vault_id: Url to the KeyVault Secret containing the Ssl Certificate. If absolute + Url containing version is provided, auto-update of ssl certificate will not work. This requires + Api Management service to be configured with aka.ms/apimmsi. The secret should be of type + *application/x-pkcs12*. + :paramtype key_vault_id: str + :keyword identity_client_id: System or User Assigned Managed identity clientId as generated by + Azure AD, which has GET access to the keyVault containing the SSL certificate. + :paramtype identity_client_id: str + :keyword encoded_certificate: Base64 Encoded certificate. + :paramtype encoded_certificate: str + :keyword certificate_password: Certificate Password. + :paramtype certificate_password: str + :keyword default_ssl_binding: Specify true to setup the certificate associated with this + Hostname as the Default SSL Certificate. If a client does not send the SNI header, then this + will be the certificate that will be challenged. The property is useful if a service has + multiple custom hostname enabled and it needs to decide on the default ssl certificate. The + setting only applied to Proxy Hostname Type. + :paramtype default_ssl_binding: bool + :keyword negotiate_client_certificate: Specify true to always negotiate client certificate on + the hostname. Default Value is false. + :paramtype negotiate_client_certificate: bool + :keyword certificate: Certificate information. + :paramtype certificate: ~azure.mgmt.apimanagement.models.CertificateInformation + :keyword certificate_source: Certificate Source. Possible values include: "Managed", + "KeyVault", "Custom", "BuiltIn". + :paramtype certificate_source: str or ~azure.mgmt.apimanagement.models.CertificateSource + :keyword certificate_status: Certificate Status. Possible values include: "Completed", + "Failed", "InProgress". + :paramtype certificate_status: str or ~azure.mgmt.apimanagement.models.CertificateStatus + """ super(HostnameConfiguration, self).__init__(**kwargs) self.type = type self.host_name = host_name @@ -6820,17 +9853,58 @@ def __init__( self.default_ssl_binding = default_ssl_binding self.negotiate_client_certificate = negotiate_client_certificate self.certificate = certificate + self.certificate_source = certificate_source + self.certificate_status = certificate_status + + +class HTTPHeader(msrest.serialization.Model): + """HTTP header and it's value. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Header name. + :vartype name: str + :ivar value: Required. Header value. + :vartype value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + """ + :keyword name: Required. Header name. + :paramtype name: str + :keyword value: Required. Header value. + :paramtype value: str + """ + super(HTTPHeader, self).__init__(**kwargs) + self.name = name + self.value = value class HttpMessageDiagnostic(msrest.serialization.Model): """Http message diagnostic settings. - :param headers: Array of HTTP Headers to log. - :type headers: list[str] - :param body: Body logging settings. - :type body: ~azure.mgmt.apimanagement.models.BodyDiagnosticSettings - :param data_masking: Data masking settings. - :type data_masking: ~azure.mgmt.apimanagement.models.DataMasking + :ivar headers: Array of HTTP Headers to log. + :vartype headers: list[str] + :ivar body: Body logging settings. + :vartype body: ~azure.mgmt.apimanagement.models.BodyDiagnosticSettings + :ivar data_masking: Data masking settings. + :vartype data_masking: ~azure.mgmt.apimanagement.models.DataMasking """ _attribute_map = { @@ -6847,6 +9921,14 @@ def __init__( data_masking: Optional["DataMasking"] = None, **kwargs ): + """ + :keyword headers: Array of HTTP Headers to log. + :paramtype headers: list[str] + :keyword body: Body logging settings. + :paramtype body: ~azure.mgmt.apimanagement.models.BodyDiagnosticSettings + :keyword data_masking: Data masking settings. + :paramtype data_masking: ~azure.mgmt.apimanagement.models.DataMasking + """ super(HttpMessageDiagnostic, self).__init__(**kwargs) self.headers = headers self.body = body @@ -6856,25 +9938,25 @@ def __init__( class IdentityProviderBaseParameters(msrest.serialization.Model): """Identity Provider Base Parameter Properties. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str + :vartype password_reset_policy_name: str """ _validation = { @@ -6909,6 +9991,29 @@ def __init__( password_reset_policy_name: Optional[str] = None, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + """ super(IdentityProviderBaseParameters, self).__init__(**kwargs) self.type = type self.signin_tenant = signin_tenant @@ -6925,39 +10030,41 @@ class IdentityProviderContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param type_properties_type: Identity Provider Type identifier. Possible values include: + :ivar type_properties_type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -7004,6 +10111,37 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword type_properties_type: Identity Provider Type identifier. Possible values include: + "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderContract, self).__init__(**kwargs) self.type_properties_type = type_properties_type self.signin_tenant = signin_tenant @@ -7022,33 +10160,33 @@ class IdentityProviderContractProperties(IdentityProviderBaseParameters): All required parameters must be populated in order to send to Azure. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Required. Client Id of the Application in the external Identity Provider. It + :vartype password_reset_policy_name: str + :ivar client_id: Required. Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -7089,6 +10227,37 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Required. Client Id of the Application in the external Identity Provider. + It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderContractProperties, self).__init__(type=type, signin_tenant=signin_tenant, allowed_tenants=allowed_tenants, authority=authority, signup_policy_name=signup_policy_name, signin_policy_name=signin_policy_name, profile_editing_policy_name=profile_editing_policy_name, password_reset_policy_name=password_reset_policy_name, **kwargs) self.client_id = client_id self.client_secret = client_secret @@ -7099,39 +10268,41 @@ class IdentityProviderCreateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param type_properties_type: Identity Provider Type identifier. Possible values include: + :ivar type_properties_type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -7178,6 +10349,37 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword type_properties_type: Identity Provider Type identifier. Possible values include: + "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type_properties_type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! + Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderCreateContract, self).__init__(**kwargs) self.type_properties_type = type_properties_type self.signin_tenant = signin_tenant @@ -7196,33 +10398,33 @@ class IdentityProviderCreateContractProperties(IdentityProviderBaseParameters): All required parameters must be populated in order to send to Azure. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Required. Client Id of the Application in the external Identity Provider. It + :vartype password_reset_policy_name: str + :ivar client_id: Required. Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Required. Client secret of the Application in external Identity Provider, + :vartype client_id: str + :ivar client_secret: Required. Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -7263,6 +10465,37 @@ def __init__( password_reset_policy_name: Optional[str] = None, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Required. Client Id of the Application in the external Identity Provider. + It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Required. Client secret of the Application in external Identity + Provider, used to authenticate login request. For example, it is App Secret for Facebook login, + API Key for Google login, Public Key for Microsoft. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype client_secret: str + """ super(IdentityProviderCreateContractProperties, self).__init__(type=type, signin_tenant=signin_tenant, allowed_tenants=allowed_tenants, authority=authority, signup_policy_name=signup_policy_name, signin_policy_name=signin_policy_name, profile_editing_policy_name=profile_editing_policy_name, password_reset_policy_name=password_reset_policy_name, **kwargs) self.client_id = client_id self.client_secret = client_secret @@ -7271,12 +10504,12 @@ def __init__( class IdentityProviderList(msrest.serialization.Model): """List of all the Identity Providers configured on the service instance. - :param value: Identity Provider configuration values. - :type value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Identity Provider configuration values. + :vartype value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -7293,6 +10526,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Identity Provider configuration values. + :paramtype value: list[~azure.mgmt.apimanagement.models.IdentityProviderContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(IdentityProviderList, self).__init__(**kwargs) self.value = value self.count = count @@ -7302,32 +10543,32 @@ def __init__( class IdentityProviderUpdateParameters(msrest.serialization.Model): """Parameters supplied to update Identity Provider. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -7368,6 +10609,36 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. + :paramtype client_secret: str + """ super(IdentityProviderUpdateParameters, self).__init__(**kwargs) self.type = type self.signin_tenant = signin_tenant @@ -7384,32 +10655,32 @@ def __init__( class IdentityProviderUpdateProperties(IdentityProviderBaseParameters): """Parameters supplied to the Update Identity Provider operation. - :param type: Identity Provider Type identifier. Possible values include: "facebook", "google", + :ivar type: Identity Provider Type identifier. Possible values include: "facebook", "google", "microsoft", "twitter", "aad", "aadB2C". - :type type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType - :param signin_tenant: The TenantId to use instead of Common when logging into Active Directory. - :type signin_tenant: str - :param allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. - :type allowed_tenants: list[str] - :param authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. - :type authority: str - :param signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. - :type signup_policy_name: str - :param signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. - :type signin_policy_name: str - :param profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + :vartype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :ivar signin_tenant: The TenantId to use instead of Common when logging into Active Directory. + :vartype signin_tenant: str + :ivar allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory login. + :vartype allowed_tenants: list[str] + :ivar authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :vartype authority: str + :ivar signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signup_policy_name: str + :ivar signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :vartype signin_policy_name: str + :ivar profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C Identity Provider. - :type profile_editing_policy_name: str - :param password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity + :vartype profile_editing_policy_name: str + :ivar password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C Identity Provider. - :type password_reset_policy_name: str - :param client_id: Client Id of the Application in the external Identity Provider. It is App ID + :vartype password_reset_policy_name: str + :ivar client_id: Client Id of the Application in the external Identity Provider. It is App ID for Facebook login, Client ID for Google login, App ID for Microsoft. - :type client_id: str - :param client_secret: Client secret of the Application in external Identity Provider, used to + :vartype client_id: str + :ivar client_secret: Client secret of the Application in external Identity Provider, used to authenticate login request. For example, it is App Secret for Facebook login, API Key for Google login, Public Key for Microsoft. - :type client_secret: str + :vartype client_secret: str """ _validation = { @@ -7450,6 +10721,36 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword type: Identity Provider Type identifier. Possible values include: "facebook", + "google", "microsoft", "twitter", "aad", "aadB2C". + :paramtype type: str or ~azure.mgmt.apimanagement.models.IdentityProviderType + :keyword signin_tenant: The TenantId to use instead of Common when logging into Active + Directory. + :paramtype signin_tenant: str + :keyword allowed_tenants: List of Allowed Tenants when configuring Azure Active Directory + login. + :paramtype allowed_tenants: list[str] + :keyword authority: OpenID Connect discovery endpoint hostname for AAD or AAD B2C. + :paramtype authority: str + :keyword signup_policy_name: Signup Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signup_policy_name: str + :keyword signin_policy_name: Signin Policy Name. Only applies to AAD B2C Identity Provider. + :paramtype signin_policy_name: str + :keyword profile_editing_policy_name: Profile Editing Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype profile_editing_policy_name: str + :keyword password_reset_policy_name: Password Reset Policy Name. Only applies to AAD B2C + Identity Provider. + :paramtype password_reset_policy_name: str + :keyword client_id: Client Id of the Application in the external Identity Provider. It is App + ID for Facebook login, Client ID for Google login, App ID for Microsoft. + :paramtype client_id: str + :keyword client_secret: Client secret of the Application in external Identity Provider, used to + authenticate login request. For example, it is App Secret for Facebook login, API Key for + Google login, Public Key for Microsoft. + :paramtype client_secret: str + """ super(IdentityProviderUpdateProperties, self).__init__(type=type, signin_tenant=signin_tenant, allowed_tenants=allowed_tenants, authority=authority, signup_policy_name=signup_policy_name, signin_policy_name=signin_policy_name, profile_editing_policy_name=profile_editing_policy_name, password_reset_policy_name=password_reset_policy_name, **kwargs) self.client_id = client_id self.client_secret = client_secret @@ -7462,8 +10763,8 @@ class IssueAttachmentCollection(msrest.serialization.Model): :ivar value: Issue Attachment values. :vartype value: list[~azure.mgmt.apimanagement.models.IssueAttachmentContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -7485,6 +10786,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(IssueAttachmentCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -7496,19 +10801,21 @@ class IssueAttachmentContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param title: Filename by which the binary data will be saved. - :type title: str - :param content_format: Either 'link' if content is provided via an HTTP link or the MIME type - of the Base64-encoded binary data provided in the 'content' property. - :type content_format: str - :param content: An HTTP link or Base64-encoded binary data. - :type content: str + :ivar title: Filename by which the binary data will be saved. + :vartype title: str + :ivar content_format: Either 'link' if content is provided via an HTTP link or the MIME type of + the Base64-encoded binary data provided in the 'content' property. + :vartype content_format: str + :ivar content: An HTTP link or Base64-encoded binary data. + :vartype content: str """ _validation = { @@ -7534,6 +10841,15 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword title: Filename by which the binary data will be saved. + :paramtype title: str + :keyword content_format: Either 'link' if content is provided via an HTTP link or the MIME type + of the Base64-encoded binary data provided in the 'content' property. + :paramtype content_format: str + :keyword content: An HTTP link or Base64-encoded binary data. + :paramtype content: str + """ super(IssueAttachmentContract, self).__init__(**kwargs) self.title = title self.content_format = content_format @@ -7547,8 +10863,8 @@ class IssueCollection(msrest.serialization.Model): :ivar value: Issue values. :vartype value: list[~azure.mgmt.apimanagement.models.IssueContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -7570,6 +10886,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(IssueCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -7583,8 +10903,8 @@ class IssueCommentCollection(msrest.serialization.Model): :ivar value: Issue Comment values. :vartype value: list[~azure.mgmt.apimanagement.models.IssueCommentContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -7606,6 +10926,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(IssueCommentCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -7617,18 +10941,20 @@ class IssueCommentContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param text: Comment text. - :type text: str - :param created_date: Date and time when the comment was created. - :type created_date: ~datetime.datetime - :param user_id: A resource identifier for the user who left the comment. - :type user_id: str + :ivar text: Comment text. + :vartype text: str + :ivar created_date: Date and time when the comment was created. + :vartype created_date: ~datetime.datetime + :ivar user_id: A resource identifier for the user who left the comment. + :vartype user_id: str """ _validation = { @@ -7654,6 +10980,14 @@ def __init__( user_id: Optional[str] = None, **kwargs ): + """ + :keyword text: Comment text. + :paramtype text: str + :keyword created_date: Date and time when the comment was created. + :paramtype created_date: ~datetime.datetime + :keyword user_id: A resource identifier for the user who left the comment. + :paramtype user_id: str + """ super(IssueCommentContract, self).__init__(**kwargs) self.text = text self.created_date = created_date @@ -7665,25 +10999,27 @@ class IssueContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: The issue title. - :type title: str - :param description: Text describing the issue. - :type description: str - :param user_id: A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: The issue title. + :vartype title: str + :ivar description: Text describing the issue. + :vartype description: str + :ivar user_id: A resource identifier for the user created the issue. + :vartype user_id: str """ _validation = { @@ -7715,6 +11051,21 @@ def __init__( user_id: Optional[str] = None, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: The issue title. + :paramtype title: str + :keyword description: Text describing the issue. + :paramtype description: str + :keyword user_id: A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueContract, self).__init__(**kwargs) self.created_date = created_date self.state = state @@ -7727,13 +11078,13 @@ def __init__( class IssueContractBaseProperties(msrest.serialization.Model): """Issue contract Base Properties. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str """ _attribute_map = { @@ -7750,6 +11101,15 @@ def __init__( api_id: Optional[str] = None, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + """ super(IssueContractBaseProperties, self).__init__(**kwargs) self.created_date = created_date self.state = state @@ -7761,19 +11121,19 @@ class IssueContractProperties(IssueContractBaseProperties): All required parameters must be populated in order to send to Azure. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: Required. The issue title. - :type title: str - :param description: Required. Text describing the issue. - :type description: str - :param user_id: Required. A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: Required. The issue title. + :vartype title: str + :ivar description: Required. Text describing the issue. + :vartype description: str + :ivar user_id: Required. A resource identifier for the user created the issue. + :vartype user_id: str """ _validation = { @@ -7802,6 +11162,21 @@ def __init__( api_id: Optional[str] = None, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: Required. The issue title. + :paramtype title: str + :keyword description: Required. Text describing the issue. + :paramtype description: str + :keyword user_id: Required. A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueContractProperties, self).__init__(created_date=created_date, state=state, api_id=api_id, **kwargs) self.title = title self.description = description @@ -7811,19 +11186,19 @@ def __init__( class IssueUpdateContract(msrest.serialization.Model): """Issue update Parameters. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: The issue title. - :type title: str - :param description: Text describing the issue. - :type description: str - :param user_id: A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: The issue title. + :vartype title: str + :ivar description: Text describing the issue. + :vartype description: str + :ivar user_id: A resource identifier for the user created the issue. + :vartype user_id: str """ _attribute_map = { @@ -7846,6 +11221,21 @@ def __init__( user_id: Optional[str] = None, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: The issue title. + :paramtype title: str + :keyword description: Text describing the issue. + :paramtype description: str + :keyword user_id: A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueUpdateContract, self).__init__(**kwargs) self.created_date = created_date self.state = state @@ -7858,19 +11248,19 @@ def __init__( class IssueUpdateContractProperties(IssueContractBaseProperties): """Issue contract Update Properties. - :param created_date: Date and time when the issue was created. - :type created_date: ~datetime.datetime - :param state: Status of the issue. Possible values include: "proposed", "open", "removed", + :ivar created_date: Date and time when the issue was created. + :vartype created_date: ~datetime.datetime + :ivar state: Status of the issue. Possible values include: "proposed", "open", "removed", "resolved", "closed". - :type state: str or ~azure.mgmt.apimanagement.models.State - :param api_id: A resource identifier for the API the issue was created for. - :type api_id: str - :param title: The issue title. - :type title: str - :param description: Text describing the issue. - :type description: str - :param user_id: A resource identifier for the user created the issue. - :type user_id: str + :vartype state: str or ~azure.mgmt.apimanagement.models.State + :ivar api_id: A resource identifier for the API the issue was created for. + :vartype api_id: str + :ivar title: The issue title. + :vartype title: str + :ivar description: Text describing the issue. + :vartype description: str + :ivar user_id: A resource identifier for the user created the issue. + :vartype user_id: str """ _attribute_map = { @@ -7893,6 +11283,21 @@ def __init__( user_id: Optional[str] = None, **kwargs ): + """ + :keyword created_date: Date and time when the issue was created. + :paramtype created_date: ~datetime.datetime + :keyword state: Status of the issue. Possible values include: "proposed", "open", "removed", + "resolved", "closed". + :paramtype state: str or ~azure.mgmt.apimanagement.models.State + :keyword api_id: A resource identifier for the API the issue was created for. + :paramtype api_id: str + :keyword title: The issue title. + :paramtype title: str + :keyword description: Text describing the issue. + :paramtype description: str + :keyword user_id: A resource identifier for the user created the issue. + :paramtype user_id: str + """ super(IssueUpdateContractProperties, self).__init__(created_date=created_date, state=state, api_id=api_id, **kwargs) self.title = title self.description = description @@ -7902,13 +11307,13 @@ def __init__( class KeyVaultContractCreateProperties(msrest.serialization.Model): """Create keyVault contract details. - :param secret_identifier: Key vault secret identifier for fetching secret. Providing a - versioned secret will prevent auto-refresh. This requires Api Management service to be - configured with aka.ms/apimmsi. - :type secret_identifier: str - :param identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will + :ivar secret_identifier: Key vault secret identifier for fetching secret. Providing a versioned + secret will prevent auto-refresh. This requires API Management service to be configured with + aka.ms/apimmsi. + :vartype secret_identifier: str + :ivar identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret. - :type identity_client_id: str + :vartype identity_client_id: str """ _attribute_map = { @@ -7923,6 +11328,15 @@ def __init__( identity_client_id: Optional[str] = None, **kwargs ): + """ + :keyword secret_identifier: Key vault secret identifier for fetching secret. Providing a + versioned secret will prevent auto-refresh. This requires API Management service to be + configured with aka.ms/apimmsi. + :paramtype secret_identifier: str + :keyword identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which + will be used to access key vault secret. + :paramtype identity_client_id: str + """ super(KeyVaultContractCreateProperties, self).__init__(**kwargs) self.secret_identifier = secret_identifier self.identity_client_id = identity_client_id @@ -7931,15 +11345,16 @@ def __init__( class KeyVaultContractProperties(KeyVaultContractCreateProperties): """KeyVault contract details. - :param secret_identifier: Key vault secret identifier for fetching secret. Providing a - versioned secret will prevent auto-refresh. This requires Api Management service to be - configured with aka.ms/apimmsi. - :type secret_identifier: str - :param identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will + :ivar secret_identifier: Key vault secret identifier for fetching secret. Providing a versioned + secret will prevent auto-refresh. This requires API Management service to be configured with + aka.ms/apimmsi. + :vartype secret_identifier: str + :ivar identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret. - :type identity_client_id: str - :param last_status: Last time sync and refresh status of secret from key vault. - :type last_status: ~azure.mgmt.apimanagement.models.KeyVaultLastAccessStatusContractProperties + :vartype identity_client_id: str + :ivar last_status: Last time sync and refresh status of secret from key vault. + :vartype last_status: + ~azure.mgmt.apimanagement.models.KeyVaultLastAccessStatusContractProperties """ _attribute_map = { @@ -7956,6 +11371,18 @@ def __init__( last_status: Optional["KeyVaultLastAccessStatusContractProperties"] = None, **kwargs ): + """ + :keyword secret_identifier: Key vault secret identifier for fetching secret. Providing a + versioned secret will prevent auto-refresh. This requires API Management service to be + configured with aka.ms/apimmsi. + :paramtype secret_identifier: str + :keyword identity_client_id: SystemAssignedIdentity or UserAssignedIdentity Client Id which + will be used to access key vault secret. + :paramtype identity_client_id: str + :keyword last_status: Last time sync and refresh status of secret from key vault. + :paramtype last_status: + ~azure.mgmt.apimanagement.models.KeyVaultLastAccessStatusContractProperties + """ super(KeyVaultContractProperties, self).__init__(secret_identifier=secret_identifier, identity_client_id=identity_client_id, **kwargs) self.last_status = last_status @@ -7963,13 +11390,13 @@ def __init__( class KeyVaultLastAccessStatusContractProperties(msrest.serialization.Model): """Issue contract Update Properties. - :param code: Last status code for sync and refresh of secret from key vault. - :type code: str - :param message: Details of the error else empty. - :type message: str - :param time_stamp_utc: Last time secret was accessed. The date conforms to the following - format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type time_stamp_utc: ~datetime.datetime + :ivar code: Last status code for sync and refresh of secret from key vault. + :vartype code: str + :ivar message: Details of the error else empty. + :vartype message: str + :ivar time_stamp_utc: Last time secret was accessed. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype time_stamp_utc: ~datetime.datetime """ _attribute_map = { @@ -7986,6 +11413,15 @@ def __init__( time_stamp_utc: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword code: Last status code for sync and refresh of secret from key vault. + :paramtype code: str + :keyword message: Details of the error else empty. + :paramtype message: str + :keyword time_stamp_utc: Last time secret was accessed. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype time_stamp_utc: ~datetime.datetime + """ super(KeyVaultLastAccessStatusContractProperties, self).__init__(**kwargs) self.code = code self.message = message @@ -7995,12 +11431,12 @@ def __init__( class LoggerCollection(msrest.serialization.Model): """Paged Logger list representation. - :param value: Logger values. - :type value: list[~azure.mgmt.apimanagement.models.LoggerContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Logger values. + :vartype value: list[~azure.mgmt.apimanagement.models.LoggerContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -8017,6 +11453,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Logger values. + :paramtype value: list[~azure.mgmt.apimanagement.models.LoggerContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(LoggerCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -8028,27 +11472,29 @@ class LoggerContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param logger_type: Logger type. Possible values include: "azureEventHub", + :ivar logger_type: Logger type. Possible values include: "azureEventHub", "applicationInsights", "azureMonitor". - :type logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType - :param description: Logger description. - :type description: str - :param credentials: The name and SendRule connection string of the event hub for azureEventHub + :vartype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :ivar description: Logger description. + :vartype description: str + :ivar credentials: The name and SendRule connection string of the event hub for azureEventHub logger. Instrumentation key for applicationInsights logger. - :type credentials: dict[str, str] - :param is_buffered: Whether records are buffered in the logger before publishing. Default is + :vartype credentials: dict[str, str] + :ivar is_buffered: Whether records are buffered in the logger before publishing. Default is assumed to be true. - :type is_buffered: bool - :param resource_id: Azure Resource Id of a log target (either Azure Event Hub resource or Azure + :vartype is_buffered: bool + :ivar resource_id: Azure Resource Id of a log target (either Azure Event Hub resource or Azure Application Insights resource). - :type resource_id: str + :vartype resource_id: str """ _validation = { @@ -8079,6 +11525,23 @@ def __init__( resource_id: Optional[str] = None, **kwargs ): + """ + :keyword logger_type: Logger type. Possible values include: "azureEventHub", + "applicationInsights", "azureMonitor". + :paramtype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :keyword description: Logger description. + :paramtype description: str + :keyword credentials: The name and SendRule connection string of the event hub for + azureEventHub logger. + Instrumentation key for applicationInsights logger. + :paramtype credentials: dict[str, str] + :keyword is_buffered: Whether records are buffered in the logger before publishing. Default is + assumed to be true. + :paramtype is_buffered: bool + :keyword resource_id: Azure Resource Id of a log target (either Azure Event Hub resource or + Azure Application Insights resource). + :paramtype resource_id: str + """ super(LoggerContract, self).__init__(**kwargs) self.logger_type = logger_type self.description = description @@ -8090,16 +11553,16 @@ def __init__( class LoggerUpdateContract(msrest.serialization.Model): """Logger update contract. - :param logger_type: Logger type. Possible values include: "azureEventHub", + :ivar logger_type: Logger type. Possible values include: "azureEventHub", "applicationInsights", "azureMonitor". - :type logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType - :param description: Logger description. - :type description: str - :param credentials: Logger credentials. - :type credentials: dict[str, str] - :param is_buffered: Whether records are buffered in the logger before publishing. Default is + :vartype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :ivar description: Logger description. + :vartype description: str + :ivar credentials: Logger credentials. + :vartype credentials: dict[str, str] + :ivar is_buffered: Whether records are buffered in the logger before publishing. Default is assumed to be true. - :type is_buffered: bool + :vartype is_buffered: bool """ _attribute_map = { @@ -8118,6 +11581,18 @@ def __init__( is_buffered: Optional[bool] = None, **kwargs ): + """ + :keyword logger_type: Logger type. Possible values include: "azureEventHub", + "applicationInsights", "azureMonitor". + :paramtype logger_type: str or ~azure.mgmt.apimanagement.models.LoggerType + :keyword description: Logger description. + :paramtype description: str + :keyword credentials: Logger credentials. + :paramtype credentials: dict[str, str] + :keyword is_buffered: Whether records are buffered in the logger before publishing. Default is + assumed to be true. + :paramtype is_buffered: bool + """ super(LoggerUpdateContract, self).__init__(**kwargs) self.logger_type = logger_type self.description = description @@ -8128,12 +11603,12 @@ def __init__( class NamedValueCollection(msrest.serialization.Model): """Paged NamedValue list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.NamedValueContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.NamedValueContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -8150,6 +11625,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.NamedValueContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(NamedValueCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -8161,27 +11644,29 @@ class NamedValueContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties """ _validation = { @@ -8214,6 +11699,23 @@ def __init__( key_vault: Optional["KeyVaultContractProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + """ super(NamedValueContract, self).__init__(**kwargs) self.tags = tags self.secret = secret @@ -8225,12 +11727,12 @@ def __init__( class NamedValueEntityBaseParameters(msrest.serialization.Model): """NamedValue Entity Base Parameters set. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool + :vartype secret: bool """ _validation = { @@ -8249,6 +11751,14 @@ def __init__( secret: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + """ super(NamedValueEntityBaseParameters, self).__init__(**kwargs) self.tags = tags self.secret = secret @@ -8259,21 +11769,21 @@ class NamedValueContractProperties(NamedValueEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Required. Unique name of NamedValue. It may contain only letters, digits, + :vartype secret: bool + :ivar display_name: Required. Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties """ _validation = { @@ -8300,6 +11810,23 @@ def __init__( key_vault: Optional["KeyVaultContractProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Required. Unique name of NamedValue. It may contain only letters, + digits, period, dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractProperties + """ super(NamedValueContractProperties, self).__init__(tags=tags, secret=secret, **kwargs) self.display_name = display_name self.value = value @@ -8311,27 +11838,29 @@ class NamedValueCreateContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -8364,6 +11893,23 @@ def __init__( key_vault: Optional["KeyVaultContractCreateProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueCreateContract, self).__init__(**kwargs) self.tags = tags self.secret = secret @@ -8377,21 +11923,21 @@ class NamedValueCreateContractProperties(NamedValueEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Required. Unique name of NamedValue. It may contain only letters, digits, + :vartype secret: bool + :ivar display_name: Required. Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -8418,6 +11964,23 @@ def __init__( key_vault: Optional["KeyVaultContractCreateProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Required. Unique name of NamedValue. It may contain only letters, + digits, period, dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. This property will not be filled on 'GET' operations! Use + '/listSecrets' POST request to get the value. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueCreateContractProperties, self).__init__(tags=tags, secret=secret, **kwargs) self.display_name = display_name self.value = value @@ -8427,8 +11990,8 @@ def __init__( class NamedValueSecretContract(msrest.serialization.Model): """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. - :param value: This is secret value of the NamedValue entity. - :type value: str + :ivar value: This is secret value of the NamedValue entity. + :vartype value: str """ _attribute_map = { @@ -8441,6 +12004,10 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: This is secret value of the NamedValue entity. + :paramtype value: str + """ super(NamedValueSecretContract, self).__init__(**kwargs) self.value = value @@ -8448,20 +12015,20 @@ def __init__( class NamedValueUpdateParameterProperties(NamedValueEntityBaseParameters): """NamedValue Contract properties. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -8488,6 +12055,22 @@ def __init__( key_vault: Optional["KeyVaultContractCreateProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueUpdateParameterProperties, self).__init__(tags=tags, secret=secret, **kwargs) self.display_name = display_name self.value = value @@ -8497,20 +12080,20 @@ def __init__( class NamedValueUpdateParameters(msrest.serialization.Model): """NamedValue update Parameters. - :param tags: A set of tags. Optional tags that when provided can be used to filter the + :ivar tags: A set of tags. Optional tags that when provided can be used to filter the NamedValue list. - :type tags: list[str] - :param secret: Determines whether the value is a secret and should be encrypted or not. Default + :vartype tags: list[str] + :ivar secret: Determines whether the value is a secret and should be encrypted or not. Default value is false. - :type secret: bool - :param display_name: Unique name of NamedValue. It may contain only letters, digits, period, + :vartype secret: bool + :ivar display_name: Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters. - :type display_name: str - :param value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + :vartype display_name: str + :ivar value: Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. - :type value: str - :param key_vault: KeyVault location details of the namedValue. - :type key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + :vartype value: str + :ivar key_vault: KeyVault location details of the namedValue. + :vartype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties """ _validation = { @@ -8537,6 +12120,22 @@ def __init__( key_vault: Optional["KeyVaultContractCreateProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Optional tags that when provided can be used to filter the + NamedValue list. + :paramtype tags: list[str] + :keyword secret: Determines whether the value is a secret and should be encrypted or not. + Default value is false. + :paramtype secret: bool + :keyword display_name: Unique name of NamedValue. It may contain only letters, digits, period, + dash, and underscore characters. + :paramtype display_name: str + :keyword value: Value of the NamedValue. Can contain policy expressions. It may not be empty or + consist only of whitespace. + :paramtype value: str + :keyword key_vault: KeyVault location details of the namedValue. + :paramtype key_vault: ~azure.mgmt.apimanagement.models.KeyVaultContractCreateProperties + """ super(NamedValueUpdateParameters, self).__init__(**kwargs) self.tags = tags self.secret = secret @@ -8550,11 +12149,11 @@ class NetworkStatusContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param dns_servers: Required. Gets the list of DNS servers IPV4 addresses. - :type dns_servers: list[str] - :param connectivity_status: Required. Gets the list of Connectivity Status to the Resources on + :ivar dns_servers: Required. Gets the list of DNS servers IPV4 addresses. + :vartype dns_servers: list[str] + :ivar connectivity_status: Required. Gets the list of Connectivity Status to the Resources on which the service depends upon. - :type connectivity_status: list[~azure.mgmt.apimanagement.models.ConnectivityStatusContract] + :vartype connectivity_status: list[~azure.mgmt.apimanagement.models.ConnectivityStatusContract] """ _validation = { @@ -8574,6 +12173,14 @@ def __init__( connectivity_status: List["ConnectivityStatusContract"], **kwargs ): + """ + :keyword dns_servers: Required. Gets the list of DNS servers IPV4 addresses. + :paramtype dns_servers: list[str] + :keyword connectivity_status: Required. Gets the list of Connectivity Status to the Resources + on which the service depends upon. + :paramtype connectivity_status: + list[~azure.mgmt.apimanagement.models.ConnectivityStatusContract] + """ super(NetworkStatusContract, self).__init__(**kwargs) self.dns_servers = dns_servers self.connectivity_status = connectivity_status @@ -8582,10 +12189,10 @@ def __init__( class NetworkStatusContractByLocation(msrest.serialization.Model): """Network Status in the Location. - :param location: Location of service. - :type location: str - :param network_status: Network status in Location. - :type network_status: ~azure.mgmt.apimanagement.models.NetworkStatusContract + :ivar location: Location of service. + :vartype location: str + :ivar network_status: Network status in Location. + :vartype network_status: ~azure.mgmt.apimanagement.models.NetworkStatusContract """ _validation = { @@ -8604,6 +12211,12 @@ def __init__( network_status: Optional["NetworkStatusContract"] = None, **kwargs ): + """ + :keyword location: Location of service. + :paramtype location: str + :keyword network_status: Network status in Location. + :paramtype network_status: ~azure.mgmt.apimanagement.models.NetworkStatusContract + """ super(NetworkStatusContractByLocation, self).__init__(**kwargs) self.location = location self.network_status = network_status @@ -8612,12 +12225,12 @@ def __init__( class NotificationCollection(msrest.serialization.Model): """Paged Notification list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.NotificationContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.NotificationContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -8634,6 +12247,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.NotificationContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(NotificationCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -8645,18 +12266,20 @@ class NotificationContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param title: Title of the Notification. - :type title: str - :param description: Description of the Notification. - :type description: str - :param recipients: Recipient Parameter values. - :type recipients: ~azure.mgmt.apimanagement.models.RecipientsContractProperties + :ivar title: Title of the Notification. + :vartype title: str + :ivar description: Description of the Notification. + :vartype description: str + :ivar recipients: Recipient Parameter values. + :vartype recipients: ~azure.mgmt.apimanagement.models.RecipientsContractProperties """ _validation = { @@ -8683,6 +12306,14 @@ def __init__( recipients: Optional["RecipientsContractProperties"] = None, **kwargs ): + """ + :keyword title: Title of the Notification. + :paramtype title: str + :keyword description: Description of the Notification. + :paramtype description: str + :keyword recipients: Recipient Parameter values. + :paramtype recipients: ~azure.mgmt.apimanagement.models.RecipientsContractProperties + """ super(NotificationContract, self).__init__(**kwargs) self.title = title self.description = description @@ -8692,10 +12323,10 @@ def __init__( class OAuth2AuthenticationSettingsContract(msrest.serialization.Model): """API OAuth2 Authentication settings details. - :param authorization_server_id: OAuth authorization server identifier. - :type authorization_server_id: str - :param scope: operations scope. - :type scope: str + :ivar authorization_server_id: OAuth authorization server identifier. + :vartype authorization_server_id: str + :ivar scope: operations scope. + :vartype scope: str """ _attribute_map = { @@ -8710,6 +12341,12 @@ def __init__( scope: Optional[str] = None, **kwargs ): + """ + :keyword authorization_server_id: OAuth authorization server identifier. + :paramtype authorization_server_id: str + :keyword scope: operations scope. + :paramtype scope: str + """ super(OAuth2AuthenticationSettingsContract, self).__init__(**kwargs) self.authorization_server_id = authorization_server_id self.scope = scope @@ -8718,10 +12355,10 @@ def __init__( class OpenIdAuthenticationSettingsContract(msrest.serialization.Model): """API OAuth2 Authentication settings details. - :param openid_provider_id: OAuth authorization server identifier. - :type openid_provider_id: str - :param bearer_token_sending_methods: How to send token to the server. - :type bearer_token_sending_methods: list[str or + :ivar openid_provider_id: OAuth authorization server identifier. + :vartype openid_provider_id: str + :ivar bearer_token_sending_methods: How to send token to the server. + :vartype bearer_token_sending_methods: list[str or ~azure.mgmt.apimanagement.models.BearerTokenSendingMethods] """ @@ -8737,6 +12374,13 @@ def __init__( bearer_token_sending_methods: Optional[List[Union[str, "BearerTokenSendingMethods"]]] = None, **kwargs ): + """ + :keyword openid_provider_id: OAuth authorization server identifier. + :paramtype openid_provider_id: str + :keyword bearer_token_sending_methods: How to send token to the server. + :paramtype bearer_token_sending_methods: list[str or + ~azure.mgmt.apimanagement.models.BearerTokenSendingMethods] + """ super(OpenIdAuthenticationSettingsContract, self).__init__(**kwargs) self.openid_provider_id = openid_provider_id self.bearer_token_sending_methods = bearer_token_sending_methods @@ -8745,12 +12389,12 @@ def __init__( class OpenIdConnectProviderCollection(msrest.serialization.Model): """Paged OpenIdProviders list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -8767,6 +12411,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.OpenidConnectProviderContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(OpenIdConnectProviderCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -8778,22 +12430,24 @@ class OpenidConnectProviderContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param display_name: User-friendly OpenID Connect Provider name. - :type display_name: str - :param description: User-friendly description of OpenID Connect Provider. - :type description: str - :param metadata_endpoint: Metadata endpoint URI. - :type metadata_endpoint: str - :param client_id: Client ID of developer console which is the client application. - :type client_id: str - :param client_secret: Client Secret of developer console which is the client application. - :type client_secret: str + :ivar display_name: User-friendly OpenID Connect Provider name. + :vartype display_name: str + :ivar description: User-friendly description of OpenID Connect Provider. + :vartype description: str + :ivar metadata_endpoint: Metadata endpoint URI. + :vartype metadata_endpoint: str + :ivar client_id: Client ID of developer console which is the client application. + :vartype client_id: str + :ivar client_secret: Client Secret of developer console which is the client application. + :vartype client_secret: str """ _validation = { @@ -8824,6 +12478,18 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword display_name: User-friendly OpenID Connect Provider name. + :paramtype display_name: str + :keyword description: User-friendly description of OpenID Connect Provider. + :paramtype description: str + :keyword metadata_endpoint: Metadata endpoint URI. + :paramtype metadata_endpoint: str + :keyword client_id: Client ID of developer console which is the client application. + :paramtype client_id: str + :keyword client_secret: Client Secret of developer console which is the client application. + :paramtype client_secret: str + """ super(OpenidConnectProviderContract, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -8835,16 +12501,16 @@ def __init__( class OpenidConnectProviderUpdateContract(msrest.serialization.Model): """Parameters supplied to the Update OpenID Connect Provider operation. - :param display_name: User-friendly OpenID Connect Provider name. - :type display_name: str - :param description: User-friendly description of OpenID Connect Provider. - :type description: str - :param metadata_endpoint: Metadata endpoint URI. - :type metadata_endpoint: str - :param client_id: Client ID of developer console which is the client application. - :type client_id: str - :param client_secret: Client Secret of developer console which is the client application. - :type client_secret: str + :ivar display_name: User-friendly OpenID Connect Provider name. + :vartype display_name: str + :ivar description: User-friendly description of OpenID Connect Provider. + :vartype description: str + :ivar metadata_endpoint: Metadata endpoint URI. + :vartype metadata_endpoint: str + :ivar client_id: Client ID of developer console which is the client application. + :vartype client_id: str + :ivar client_secret: Client Secret of developer console which is the client application. + :vartype client_secret: str """ _validation = { @@ -8869,6 +12535,18 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword display_name: User-friendly OpenID Connect Provider name. + :paramtype display_name: str + :keyword description: User-friendly description of OpenID Connect Provider. + :paramtype description: str + :keyword metadata_endpoint: Metadata endpoint URI. + :paramtype metadata_endpoint: str + :keyword client_id: Client ID of developer console which is the client application. + :paramtype client_id: str + :keyword client_secret: Client Secret of developer console which is the client application. + :paramtype client_secret: str + """ super(OpenidConnectProviderUpdateContract, self).__init__(**kwargs) self.display_name = display_name self.description = description @@ -8880,14 +12558,14 @@ def __init__( class Operation(msrest.serialization.Model): """REST API operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~azure.mgmt.apimanagement.models.OperationDisplay - :param origin: The operation origin. - :type origin: str - :param properties: The operation properties. - :type properties: any + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.apimanagement.models.OperationDisplay + :ivar origin: The operation origin. + :vartype origin: str + :ivar properties: The operation properties. + :vartype properties: any """ _attribute_map = { @@ -8906,6 +12584,16 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operation. + :paramtype display: ~azure.mgmt.apimanagement.models.OperationDisplay + :keyword origin: The operation origin. + :paramtype origin: str + :keyword properties: The operation properties. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -8920,8 +12608,8 @@ class OperationCollection(msrest.serialization.Model): :ivar value: Page values. :vartype value: list[~azure.mgmt.apimanagement.models.OperationContract] - :param count: Total record count number across all pages. - :type count: long + :ivar count: Total record count number across all pages. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -8943,6 +12631,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(OperationCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -8950,34 +12642,36 @@ def __init__( class OperationContract(Resource): - """Api Operation details. + """API Operation details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Operation Name. - :type display_name: str - :param method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Operation Name. + :vartype display_name: str + :ivar method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - :type method: str - :param url_template: Relative URL template identifying the target resource for this operation. + :vartype method: str + :ivar url_template: Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -9016,6 +12710,26 @@ def __init__( url_template: Optional[str] = None, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Operation Name. + :paramtype display_name: str + :keyword method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but + not limited by only them. + :paramtype method: str + :keyword url_template: Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationContract, self).__init__(**kwargs) self.template_parameters = template_parameters self.description = description @@ -9028,18 +12742,18 @@ def __init__( class OperationEntityBaseContract(msrest.serialization.Model): - """Api Operation Entity Base Contract details. + """API Operation Entity Base Contract details. - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str """ _validation = { @@ -9064,6 +12778,18 @@ def __init__( policies: Optional[str] = None, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + """ super(OperationEntityBaseContract, self).__init__(**kwargs) self.template_parameters = template_parameters self.description = description @@ -9077,24 +12803,24 @@ class OperationContractProperties(OperationEntityBaseContract): All required parameters must be populated in order to send to Azure. - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Required. Operation Name. - :type display_name: str - :param method: Required. A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, - POST but not limited by only them. - :type method: str - :param url_template: Required. Relative URL template identifying the target resource for this + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Required. Operation Name. + :vartype display_name: str + :ivar method: Required. A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST + but not limited by only them. + :vartype method: str + :ivar url_template: Required. Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -9128,6 +12854,26 @@ def __init__( policies: Optional[str] = None, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Required. Operation Name. + :paramtype display_name: str + :keyword method: Required. A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, + POST but not limited by only them. + :paramtype method: str + :keyword url_template: Required. Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationContractProperties, self).__init__(template_parameters=template_parameters, description=description, request=request, responses=responses, policies=policies, **kwargs) self.display_name = display_name self.method = method @@ -9137,14 +12883,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: Operation type: read, write, delete, listKeys/action, etc. - :type operation: str - :param resource: Resource type on which the operation is performed. - :type resource: str - :param description: Friendly name of the operation. - :type description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar operation: Operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar description: Friendly name of the operation. + :vartype description: str """ _attribute_map = { @@ -9163,6 +12909,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword operation: Operation type: read, write, delete, listKeys/action, etc. + :paramtype operation: str + :keyword resource: Resource type on which the operation is performed. + :paramtype resource: str + :keyword description: Friendly name of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.operation = operation @@ -9173,10 +12929,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - :param value: List of operations supported by the resource provider. - :type value: list[~azure.mgmt.apimanagement.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.apimanagement.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -9191,6 +12947,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.apimanagement.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -9201,27 +12963,29 @@ class OperationResultContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param id_properties_id: Operation result identifier. - :type id_properties_id: str - :param status: Status of an async operation. Possible values include: "Started", "InProgress", + :ivar id_properties_id: Operation result identifier. + :vartype id_properties_id: str + :ivar status: Status of an async operation. Possible values include: "Started", "InProgress", "Succeeded", "Failed". - :type status: str or ~azure.mgmt.apimanagement.models.AsyncOperationStatus - :param started: Start time of an async operation. The date conforms to the following format: + :vartype status: str or ~azure.mgmt.apimanagement.models.AsyncOperationStatus + :ivar started: Start time of an async operation. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type started: ~datetime.datetime - :param updated: Last update time of an async operation. The date conforms to the following + :vartype started: ~datetime.datetime + :ivar updated: Last update time of an async operation. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type updated: ~datetime.datetime - :param result_info: Optional result info. - :type result_info: str - :param error: Error Body Contract. - :type error: ~azure.mgmt.apimanagement.models.ErrorResponseBody + :vartype updated: ~datetime.datetime + :ivar result_info: Optional result info. + :vartype result_info: str + :ivar error: Error Body Contract. + :vartype error: ~azure.mgmt.apimanagement.models.ErrorResponseBody :ivar action_log: This property if only provided as part of the TenantConfiguration_Validate operation. It contains the log the entities which will be updated/created/deleted as part of the TenantConfiguration_Deploy operation. @@ -9259,6 +13023,23 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword id_properties_id: Operation result identifier. + :paramtype id_properties_id: str + :keyword status: Status of an async operation. Possible values include: "Started", + "InProgress", "Succeeded", "Failed". + :paramtype status: str or ~azure.mgmt.apimanagement.models.AsyncOperationStatus + :keyword started: Start time of an async operation. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype started: ~datetime.datetime + :keyword updated: Last update time of an async operation. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype updated: ~datetime.datetime + :keyword result_info: Optional result info. + :paramtype result_info: str + :keyword error: Error Body Contract. + :paramtype error: ~azure.mgmt.apimanagement.models.ErrorResponseBody + """ super(OperationResultContract, self).__init__(**kwargs) self.id_properties_id = id_properties_id self.status = status @@ -9272,12 +13053,12 @@ def __init__( class OperationResultLogItemContract(msrest.serialization.Model): """Log of the entity being created, updated or deleted. - :param object_type: The type of entity contract. - :type object_type: str - :param action: Action like create/update/delete. - :type action: str - :param object_key: Identifier of the entity being created/updated/deleted. - :type object_key: str + :ivar object_type: The type of entity contract. + :vartype object_type: str + :ivar action: Action like create/update/delete. + :vartype action: str + :ivar object_key: Identifier of the entity being created/updated/deleted. + :vartype object_key: str """ _attribute_map = { @@ -9294,6 +13075,14 @@ def __init__( object_key: Optional[str] = None, **kwargs ): + """ + :keyword object_type: The type of entity contract. + :paramtype object_type: str + :keyword action: Action like create/update/delete. + :paramtype action: str + :keyword object_key: Identifier of the entity being created/updated/deleted. + :paramtype object_key: str + """ super(OperationResultLogItemContract, self).__init__(**kwargs) self.object_type = object_type self.action = action @@ -9305,15 +13094,15 @@ class OperationTagResourceContractProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Identifier of the operation in form /operations/{operationId}. - :type id: str + :ivar id: Identifier of the operation in form /operations/{operationId}. + :vartype id: str :ivar name: Operation name. :vartype name: str - :ivar api_name: Api Name. + :ivar api_name: API Name. :vartype api_name: str - :ivar api_revision: Api Revision. + :ivar api_revision: API Revision. :vartype api_revision: str - :ivar api_version: Api Version. + :ivar api_version: API Version. :vartype api_version: str :ivar description: Operation Description. :vartype description: str @@ -9352,6 +13141,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Identifier of the operation in form /operations/{operationId}. + :paramtype id: str + """ super(OperationTagResourceContractProperties, self).__init__(**kwargs) self.id = id self.name = None @@ -9364,26 +13157,26 @@ def __init__( class OperationUpdateContract(msrest.serialization.Model): - """Api Operation Update Contract details. - - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Operation Name. - :type display_name: str - :param method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not + """API Operation Update Contract details. + + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Operation Name. + :vartype display_name: str + :ivar method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - :type method: str - :param url_template: Relative URL template identifying the target resource for this operation. + :vartype method: str + :ivar url_template: Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -9416,6 +13209,26 @@ def __init__( url_template: Optional[str] = None, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Operation Name. + :paramtype display_name: str + :keyword method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but + not limited by only them. + :paramtype method: str + :keyword url_template: Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationUpdateContract, self).__init__(**kwargs) self.template_parameters = template_parameters self.description = description @@ -9430,24 +13243,24 @@ def __init__( class OperationUpdateContractProperties(OperationEntityBaseContract): """Operation Update Contract Properties. - :param template_parameters: Collection of URL template parameters. - :type template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param description: Description of the operation. May include HTML formatting tags. - :type description: str - :param request: An entity containing request details. - :type request: ~azure.mgmt.apimanagement.models.RequestContract - :param responses: Array of Operation responses. - :type responses: list[~azure.mgmt.apimanagement.models.ResponseContract] - :param policies: Operation Policies. - :type policies: str - :param display_name: Operation Name. - :type display_name: str - :param method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not + :ivar template_parameters: Collection of URL template parameters. + :vartype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar description: Description of the operation. May include HTML formatting tags. + :vartype description: str + :ivar request: An entity containing request details. + :vartype request: ~azure.mgmt.apimanagement.models.RequestContract + :ivar responses: Array of Operation responses. + :vartype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :ivar policies: Operation Policies. + :vartype policies: str + :ivar display_name: Operation Name. + :vartype display_name: str + :ivar method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but not limited by only them. - :type method: str - :param url_template: Relative URL template identifying the target resource for this operation. + :vartype method: str + :ivar url_template: Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. - :type url_template: str + :vartype url_template: str """ _validation = { @@ -9480,29 +13293,127 @@ def __init__( url_template: Optional[str] = None, **kwargs ): + """ + :keyword template_parameters: Collection of URL template parameters. + :paramtype template_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword description: Description of the operation. May include HTML formatting tags. + :paramtype description: str + :keyword request: An entity containing request details. + :paramtype request: ~azure.mgmt.apimanagement.models.RequestContract + :keyword responses: Array of Operation responses. + :paramtype responses: list[~azure.mgmt.apimanagement.models.ResponseContract] + :keyword policies: Operation Policies. + :paramtype policies: str + :keyword display_name: Operation Name. + :paramtype display_name: str + :keyword method: A Valid HTTP Operation Method. Typical Http Methods like GET, PUT, POST but + not limited by only them. + :paramtype method: str + :keyword url_template: Relative URL template identifying the target resource for this + operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}. + :paramtype url_template: str + """ super(OperationUpdateContractProperties, self).__init__(template_parameters=template_parameters, description=description, request=request, responses=responses, policies=policies, **kwargs) self.display_name = display_name self.method = method self.url_template = url_template +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Endpoints accessed for a common purpose that the Api Management Service requires outbound network access to. + + :ivar category: The type of service accessed by the Api Management Service, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :vartype category: str + :ivar endpoints: The endpoints that the Api Management Service reaches the service at. + :vartype endpoints: list[~azure.mgmt.apimanagement.models.EndpointDependency] + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["EndpointDependency"]] = None, + **kwargs + ): + """ + :keyword category: The type of service accessed by the Api Management Service, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :paramtype category: str + :keyword endpoints: The endpoints that the Api Management Service reaches the service at. + :paramtype endpoints: list[~azure.mgmt.apimanagement.models.EndpointDependency] + """ + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class OutboundEnvironmentEndpointList(msrest.serialization.Model): + """Collection of Outbound Environment Endpoints. + + 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 value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["OutboundEnvironmentEndpoint"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpoint] + """ + super(OutboundEnvironmentEndpointList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class ParameterContract(msrest.serialization.Model): """Operation parameters details. All required parameters must be populated in order to send to Azure. - :param name: Required. Parameter name. - :type name: str - :param description: Parameter description. - :type description: str - :param type: Required. Parameter type. - :type type: str - :param default_value: Default parameter value. - :type default_value: str - :param required: Specifies whether parameter is required or not. - :type required: bool - :param values: Parameter values. - :type values: list[str] + :ivar name: Required. Parameter name. + :vartype name: str + :ivar description: Parameter description. + :vartype description: str + :ivar type: Required. Parameter type. + :vartype type: str + :ivar default_value: Default parameter value. + :vartype default_value: str + :ivar required: Specifies whether parameter is required or not. + :vartype required: bool + :ivar values: Parameter values. + :vartype values: list[str] + :ivar schema_id: Schema identifier. + :vartype schema_id: str + :ivar type_name: Type name defined by the schema. + :vartype type_name: str + :ivar examples: Exampled defined for the parameter. + :vartype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] """ _validation = { @@ -9517,6 +13428,9 @@ class ParameterContract(msrest.serialization.Model): 'default_value': {'key': 'defaultValue', 'type': 'str'}, 'required': {'key': 'required', 'type': 'bool'}, 'values': {'key': 'values', 'type': '[str]'}, + 'schema_id': {'key': 'schemaId', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'examples': {'key': 'examples', 'type': '{ParameterExampleContract}'}, } def __init__( @@ -9528,8 +13442,31 @@ def __init__( default_value: Optional[str] = None, required: Optional[bool] = None, values: Optional[List[str]] = None, - **kwargs - ): + schema_id: Optional[str] = None, + type_name: Optional[str] = None, + examples: Optional[Dict[str, "ParameterExampleContract"]] = None, + **kwargs + ): + """ + :keyword name: Required. Parameter name. + :paramtype name: str + :keyword description: Parameter description. + :paramtype description: str + :keyword type: Required. Parameter type. + :paramtype type: str + :keyword default_value: Default parameter value. + :paramtype default_value: str + :keyword required: Specifies whether parameter is required or not. + :paramtype required: bool + :keyword values: Parameter values. + :paramtype values: list[str] + :keyword schema_id: Schema identifier. + :paramtype schema_id: str + :keyword type_name: Type name defined by the schema. + :paramtype type_name: str + :keyword examples: Exampled defined for the parameter. + :paramtype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + """ super(ParameterContract, self).__init__(**kwargs) self.name = name self.description = description @@ -9537,15 +13474,64 @@ def __init__( self.default_value = default_value self.required = required self.values = values + self.schema_id = schema_id + self.type_name = type_name + self.examples = examples + + +class ParameterExampleContract(msrest.serialization.Model): + """Parameter example. + + :ivar summary: Short description for the example. + :vartype summary: str + :ivar description: Long description for the example. + :vartype description: str + :ivar value: Example value. May be a primitive value, or an object. + :vartype value: any + :ivar external_value: A URL that points to the literal example. + :vartype external_value: str + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'object'}, + 'external_value': {'key': 'externalValue', 'type': 'str'}, + } + + def __init__( + self, + *, + summary: Optional[str] = None, + description: Optional[str] = None, + value: Optional[Any] = None, + external_value: Optional[str] = None, + **kwargs + ): + """ + :keyword summary: Short description for the example. + :paramtype summary: str + :keyword description: Long description for the example. + :paramtype description: str + :keyword value: Example value. May be a primitive value, or an object. + :paramtype value: any + :keyword external_value: A URL that points to the literal example. + :paramtype external_value: str + """ + super(ParameterExampleContract, self).__init__(**kwargs) + self.summary = summary + self.description = description + self.value = value + self.external_value = external_value class PipelineDiagnosticSettings(msrest.serialization.Model): """Diagnostic settings for incoming/outgoing HTTP messages to the Gateway. - :param request: Diagnostic settings for request. - :type request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic - :param response: Diagnostic settings for response. - :type response: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + :ivar request: Diagnostic settings for request. + :vartype request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + :ivar response: Diagnostic settings for response. + :vartype response: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic """ _attribute_map = { @@ -9560,6 +13546,12 @@ def __init__( response: Optional["HttpMessageDiagnostic"] = None, **kwargs ): + """ + :keyword request: Diagnostic settings for request. + :paramtype request: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + :keyword response: Diagnostic settings for response. + :paramtype response: ~azure.mgmt.apimanagement.models.HttpMessageDiagnostic + """ super(PipelineDiagnosticSettings, self).__init__(**kwargs) self.request = request self.response = response @@ -9568,12 +13560,12 @@ def __init__( class PolicyCollection(msrest.serialization.Model): """The response of the list policy operation. - :param value: Policy Contract value. - :type value: list[~azure.mgmt.apimanagement.models.PolicyContract] - :param count: Total record count number. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Policy Contract value. + :vartype value: list[~azure.mgmt.apimanagement.models.PolicyContract] + :ivar count: Total record count number. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -9590,6 +13582,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Policy Contract value. + :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyContract] + :keyword count: Total record count number. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(PolicyCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -9601,17 +13601,19 @@ class PolicyContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param value: Contents of the Policy as defined by the format. - :type value: str - :param format: Format of the policyContent. Possible values include: "xml", "xml-link", + :ivar value: Contents of the Policy as defined by the format. + :vartype value: str + :ivar format: Format of the policyContent. Possible values include: "xml", "xml-link", "rawxml", "rawxml-link". Default value: "xml". - :type format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + :vartype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat """ _validation = { @@ -9635,6 +13637,13 @@ def __init__( format: Optional[Union[str, "PolicyContentFormat"]] = "xml", **kwargs ): + """ + :keyword value: Contents of the Policy as defined by the format. + :paramtype value: str + :keyword format: Format of the policyContent. Possible values include: "xml", "xml-link", + "rawxml", "rawxml-link". Default value: "xml". + :paramtype format: str or ~azure.mgmt.apimanagement.models.PolicyContentFormat + """ super(PolicyContract, self).__init__(**kwargs) self.value = value self.format = format @@ -9643,10 +13652,10 @@ def __init__( class PolicyDescriptionCollection(msrest.serialization.Model): """Descriptions of APIM policies. - :param value: Descriptions of APIM policies. - :type value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] - :param count: Total record count number. - :type count: long + :ivar value: Descriptions of APIM policies. + :vartype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] + :ivar count: Total record count number. + :vartype count: long """ _attribute_map = { @@ -9661,6 +13670,12 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword value: Descriptions of APIM policies. + :paramtype value: list[~azure.mgmt.apimanagement.models.PolicyDescriptionContract] + :keyword count: Total record count number. + :paramtype count: long + """ super(PolicyDescriptionCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -9671,11 +13686,13 @@ class PolicyDescriptionContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str :ivar description: Policy description. :vartype description: str @@ -9703,6 +13720,8 @@ def __init__( self, **kwargs ): + """ + """ super(PolicyDescriptionContract, self).__init__(**kwargs) self.description = None self.scope = None @@ -9713,21 +13732,24 @@ class PortalDelegationSettings(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param url: A delegation Url. - :type url: str - :param validation_key: A base64-encoded validation key to validate, that a request is coming + :ivar url: A delegation Url. + :vartype url: str + :ivar validation_key: A base64-encoded validation key to validate, that a request is coming from Azure API Management. - :type validation_key: str - :param subscriptions: Subscriptions delegation settings. - :type subscriptions: ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties - :param user_registration: User registration delegation settings. - :type user_registration: + :vartype validation_key: str + :ivar subscriptions: Subscriptions delegation settings. + :vartype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :ivar user_registration: User registration delegation settings. + :vartype user_registration: ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties """ @@ -9756,6 +13778,19 @@ def __init__( user_registration: Optional["RegistrationDelegationSettingsProperties"] = None, **kwargs ): + """ + :keyword url: A delegation Url. + :paramtype url: str + :keyword validation_key: A base64-encoded validation key to validate, that a request is coming + from Azure API Management. + :paramtype validation_key: str + :keyword subscriptions: Subscriptions delegation settings. + :paramtype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :keyword user_registration: User registration delegation settings. + :paramtype user_registration: + ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties + """ super(PortalDelegationSettings, self).__init__(**kwargs) self.url = url self.validation_key = validation_key @@ -9788,32 +13823,36 @@ def __init__( self, **kwargs ): + """ + """ super(PortalRevisionCollection, self).__init__(**kwargs) self.value = None self.next_link = None class PortalRevisionContract(Resource): - """Portal revisions contract details. + """Portal Revision's contract details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Portal revision description. - :type description: str + :ivar description: Portal revision description. + :vartype description: str :ivar status_details: Portal revision publishing status details. :vartype status_details: str - :ivar status: Portal revision publishing status. Possible values include: "pending", + :ivar status: Status of the portal's revision. Possible values include: "pending", "publishing", "completed", "failed". :vartype status: str or ~azure.mgmt.apimanagement.models.PortalRevisionStatus - :param is_current: Indicates if the Portal Revision is public. - :type is_current: bool - :ivar created_date_time: Portal revision creation date and time. + :ivar is_current: Indicates if the portal's revision is public. + :vartype is_current: bool + :ivar created_date_time: Portal's revision creation date and time. :vartype created_date_time: ~datetime.datetime :ivar updated_date_time: Last updated date and time. :vartype updated_date_time: ~datetime.datetime @@ -9849,6 +13888,12 @@ def __init__( is_current: Optional[bool] = None, **kwargs ): + """ + :keyword description: Portal revision description. + :paramtype description: str + :keyword is_current: Indicates if the portal's revision is public. + :paramtype is_current: bool + """ super(PortalRevisionContract, self).__init__(**kwargs) self.description = description self.status_details = None @@ -9858,208 +13903,552 @@ def __init__( self.updated_date_time = None -class PortalSettingsCollection(msrest.serialization.Model): - """Descriptions of APIM policies. +class PortalSettingsCollection(msrest.serialization.Model): + """Descriptions of APIM policies. + + :ivar value: Descriptions of APIM policies. + :vartype value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] + :ivar count: Total record count number. + :vartype count: long + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PortalSettingsContract]'}, + 'count': {'key': 'count', 'type': 'long'}, + } + + def __init__( + self, + *, + value: Optional[List["PortalSettingsContract"]] = None, + count: Optional[int] = None, + **kwargs + ): + """ + :keyword value: Descriptions of APIM policies. + :paramtype value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] + :keyword count: Total record count number. + :paramtype count: long + """ + super(PortalSettingsCollection, self).__init__(**kwargs) + self.value = value + self.count = count + + +class PortalSettingsContract(Resource): + """Portal Settings for the Developer Portal. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar url: A delegation Url. + :vartype url: str + :ivar validation_key: A base64-encoded validation key to validate, that a request is coming + from Azure API Management. + :vartype validation_key: str + :ivar subscriptions: Subscriptions delegation settings. + :vartype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :ivar user_registration: User registration delegation settings. + :vartype user_registration: + ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties + :ivar enabled: Redirect Anonymous users to the Sign-In page. + :vartype enabled: bool + :ivar terms_of_service: Terms of service contract properties. + :vartype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + + _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'}, + 'url': {'key': 'properties.url', 'type': 'str'}, + 'validation_key': {'key': 'properties.validationKey', 'type': 'str'}, + 'subscriptions': {'key': 'properties.subscriptions', 'type': 'SubscriptionsDelegationSettingsProperties'}, + 'user_registration': {'key': 'properties.userRegistration', 'type': 'RegistrationDelegationSettingsProperties'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + validation_key: Optional[str] = None, + subscriptions: Optional["SubscriptionsDelegationSettingsProperties"] = None, + user_registration: Optional["RegistrationDelegationSettingsProperties"] = None, + enabled: Optional[bool] = None, + terms_of_service: Optional["TermsOfServiceProperties"] = None, + **kwargs + ): + """ + :keyword url: A delegation Url. + :paramtype url: str + :keyword validation_key: A base64-encoded validation key to validate, that a request is coming + from Azure API Management. + :paramtype validation_key: str + :keyword subscriptions: Subscriptions delegation settings. + :paramtype subscriptions: + ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties + :keyword user_registration: User registration delegation settings. + :paramtype user_registration: + ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties + :keyword enabled: Redirect Anonymous users to the Sign-In page. + :paramtype enabled: bool + :keyword terms_of_service: Terms of service contract properties. + :paramtype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + super(PortalSettingsContract, self).__init__(**kwargs) + self.url = url + self.validation_key = validation_key + self.subscriptions = subscriptions + self.user_registration = user_registration + self.enabled = enabled + self.terms_of_service = terms_of_service + + +class PortalSettingValidationKeyContract(msrest.serialization.Model): + """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + + :ivar validation_key: This is secret value of the validation key in portal settings. + :vartype validation_key: str + """ + + _attribute_map = { + 'validation_key': {'key': 'validationKey', 'type': 'str'}, + } + + def __init__( + self, + *, + validation_key: Optional[str] = None, + **kwargs + ): + """ + :keyword validation_key: This is secret value of the validation key in portal settings. + :paramtype validation_key: str + """ + super(PortalSettingValidationKeyContract, self).__init__(**kwargs) + self.validation_key = validation_key + + +class PortalSigninSettings(Resource): + """Sign-In settings for the Developer Portal. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar enabled: Redirect Anonymous users to the Sign-In page. + :vartype enabled: bool + """ + + _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'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Redirect Anonymous users to the Sign-In page. + :paramtype enabled: bool + """ + super(PortalSigninSettings, self).__init__(**kwargs) + self.enabled = enabled + + +class PortalSignupSettings(Resource): + """Sign-Up settings for a developer portal. + + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar enabled: Allow users to sign up on a developer portal. + :vartype enabled: bool + :ivar terms_of_service: Terms of service contract properties. + :vartype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + + _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'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + terms_of_service: Optional["TermsOfServiceProperties"] = None, + **kwargs + ): + """ + :keyword enabled: Allow users to sign up on a developer portal. + :paramtype enabled: bool + :keyword terms_of_service: Terms of service contract properties. + :paramtype terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + """ + super(PortalSignupSettings, self).__init__(**kwargs) + self.enabled = enabled + self.terms_of_service = terms_of_service + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.apimanagement.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. - :param value: Descriptions of APIM policies. - :type value: list[~azure.mgmt.apimanagement.models.PortalSettingsContract] - :param count: Total record count number. - :type count: long + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[PortalSettingsContract]'}, - 'count': {'key': 'count', 'type': 'long'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, } def __init__( self, *, - value: Optional[List["PortalSettingsContract"]] = None, - count: Optional[int] = None, + value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): - super(PortalSettingsCollection, self).__init__(**kwargs) + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value - self.count = count - -class PortalSettingsContract(Resource): - """Portal Settings for the Developer Portal. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateEndpointConnectionRequest(msrest.serialization.Model): + """A request to approve or reject a private endpoint connection. - :ivar id: Resource ID. + :ivar id: Private Endpoint Connection Resource Id. :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type for API Management resource. - :vartype type: str - :param url: A delegation Url. - :type url: str - :param validation_key: A base64-encoded validation key to validate, that a request is coming - from Azure API Management. - :type validation_key: str - :param subscriptions: Subscriptions delegation settings. - :type subscriptions: ~azure.mgmt.apimanagement.models.SubscriptionsDelegationSettingsProperties - :param user_registration: User registration delegation settings. - :type user_registration: - ~azure.mgmt.apimanagement.models.RegistrationDelegationSettingsProperties - :param enabled: Redirect Anonymous users to the Sign-In page. - :type enabled: bool - :param terms_of_service: Terms of service contract properties. - :type terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + :ivar properties: The connection state of the private endpoint connection. + :vartype properties: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties """ - _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'}, - 'url': {'key': 'properties.url', 'type': 'str'}, - 'validation_key': {'key': 'properties.validationKey', 'type': 'str'}, - 'subscriptions': {'key': 'properties.subscriptions', 'type': 'SubscriptionsDelegationSettingsProperties'}, - 'user_registration': {'key': 'properties.userRegistration', 'type': 'RegistrationDelegationSettingsProperties'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionRequestProperties'}, } def __init__( self, *, - url: Optional[str] = None, - validation_key: Optional[str] = None, - subscriptions: Optional["SubscriptionsDelegationSettingsProperties"] = None, - user_registration: Optional["RegistrationDelegationSettingsProperties"] = None, - enabled: Optional[bool] = None, - terms_of_service: Optional["TermsOfServiceProperties"] = None, + id: Optional[str] = None, + properties: Optional["PrivateEndpointConnectionRequestProperties"] = None, **kwargs ): - super(PortalSettingsContract, self).__init__(**kwargs) - self.url = url - self.validation_key = validation_key - self.subscriptions = subscriptions - self.user_registration = user_registration - self.enabled = enabled - self.terms_of_service = terms_of_service + """ + :keyword id: Private Endpoint Connection Resource Id. + :paramtype id: str + :keyword properties: The connection state of the private endpoint connection. + :paramtype properties: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequestProperties + """ + super(PrivateEndpointConnectionRequest, self).__init__(**kwargs) + self.id = id + self.properties = properties -class PortalSettingValidationKeyContract(msrest.serialization.Model): - """Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. +class PrivateEndpointConnectionRequestProperties(msrest.serialization.Model): + """The connection state of the private endpoint connection. - :param validation_key: This is secret value of the validation key in portal settings. - :type validation_key: str + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState """ _attribute_map = { - 'validation_key': {'key': 'validationKey', 'type': 'str'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, } def __init__( self, *, - validation_key: Optional[str] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): - super(PortalSettingValidationKeyContract, self).__init__(**kwargs) - self.validation_key = validation_key + """ + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnectionRequestProperties, self).__init__(**kwargs) + self.private_link_service_connection_state = private_link_service_connection_state -class PortalSigninSettings(Resource): - """Sign-In settings for the Developer Portal. +class PrivateLinkResource(Resource): + """A private link resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param enabled: Redirect Anonymous users to the Sign-In page. - :type enabled: bool + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } def __init__( self, *, - enabled: Optional[bool] = None, + required_zone_names: Optional[List[str]] = None, **kwargs ): - super(PortalSigninSettings, self).__init__(**kwargs) - self.enabled = enabled - + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names -class PortalSignupSettings(Resource): - """Sign-Up settings for a developer portal. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - :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 enabled: Allow users to sign up on a developer portal. - :type enabled: bool - :param terms_of_service: Terms of service contract properties. - :type terms_of_service: ~azure.mgmt.apimanagement.models.TermsOfServiceProperties + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] """ - _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'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'terms_of_service': {'key': 'properties.termsOfService', 'type': 'TermsOfServiceProperties'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } def __init__( self, *, - enabled: Optional[bool] = None, - terms_of_service: Optional["TermsOfServiceProperties"] = None, + value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): - super(PortalSignupSettings, self).__init__(**kwargs) - self.enabled = enabled - self.terms_of_service = terms_of_service + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.apimanagement.models.PrivateLinkResource] + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :vartype status: str or ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.apimanagement.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required class ProductCollection(msrest.serialization.Model): """Paged Products list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.ProductContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ProductContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10076,6 +14465,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ProductContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(ProductCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -10087,40 +14484,42 @@ class ProductContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { @@ -10156,6 +14555,36 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ super(ProductContract, self).__init__(**kwargs) self.description = description self.terms = terms @@ -10169,32 +14598,32 @@ def __init__( class ProductEntityBaseParameters(msrest.serialization.Model): """Product Entity Base Parameters. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState """ _validation = { @@ -10221,6 +14650,34 @@ def __init__( state: Optional[Union[str, "ProductState"]] = None, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + """ super(ProductEntityBaseParameters, self).__init__(**kwargs) self.description = description self.terms = terms @@ -10235,34 +14692,34 @@ class ProductContractProperties(ProductEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Required. Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Required. Product name. + :vartype display_name: str """ _validation = { @@ -10292,6 +14749,36 @@ def __init__( state: Optional[Union[str, "ProductState"]] = None, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Required. Product name. + :paramtype display_name: str + """ super(ProductContractProperties, self).__init__(description=description, terms=terms, subscription_required=subscription_required, approval_required=approval_required, subscriptions_limit=subscriptions_limit, state=state, **kwargs) self.display_name = display_name @@ -10301,36 +14788,36 @@ class ProductTagResourceContractProperties(ProductEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param id: Identifier of the product in the form of /products/{productId}. - :type id: str - :param name: Required. Product name. - :type name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar id: Identifier of the product in the form of /products/{productId}. + :vartype id: str + :ivar name: Required. Product name. + :vartype name: str """ _validation = { @@ -10362,6 +14849,38 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword id: Identifier of the product in the form of /products/{productId}. + :paramtype id: str + :keyword name: Required. Product name. + :paramtype name: str + """ super(ProductTagResourceContractProperties, self).__init__(description=description, terms=terms, subscription_required=subscription_required, approval_required=approval_required, subscriptions_limit=subscriptions_limit, state=state, **kwargs) self.id = id self.name = name @@ -10370,34 +14889,34 @@ def __init__( class ProductUpdateParameters(msrest.serialization.Model): """Product Update parameters. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { @@ -10427,6 +14946,36 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ super(ProductUpdateParameters, self).__init__(**kwargs) self.description = description self.terms = terms @@ -10440,34 +14989,34 @@ def __init__( class ProductUpdateProperties(ProductEntityBaseParameters): """Parameters supplied to the Update Product operation. - :param description: Product description. May include HTML formatting tags. - :type description: str - :param terms: Product terms of use. Developers trying to subscribe to the product will be + :ivar description: Product description. May include HTML formatting tags. + :vartype description: str + :ivar terms: Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process. - :type terms: str - :param subscription_required: Whether a product subscription is required for accessing APIs + :vartype terms: str + :ivar subscription_required: Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true. - :type subscription_required: bool - :param approval_required: whether subscription approval is required. If false, new - subscriptions will be approved automatically enabling 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. - :type approval_required: bool - :param subscriptions_limit: Whether the number of subscriptions a user can have to this product + :vartype subscription_required: bool + :ivar approval_required: whether subscription approval is required. If false, new subscriptions + will be approved automatically enabling 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. + :vartype approval_required: bool + :ivar 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. - :type subscriptions_limit: int - :param state: whether product is published or not. Published products are discoverable by users + :vartype subscriptions_limit: int + :ivar state: whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished. Possible values include: "notPublished", "published". - :type state: str or ~azure.mgmt.apimanagement.models.ProductState - :param display_name: Product name. - :type display_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.ProductState + :ivar display_name: Product name. + :vartype display_name: str """ _validation = { @@ -10497,6 +15046,36 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Product description. May include HTML formatting tags. + :paramtype description: str + :keyword terms: Product terms of use. Developers trying to subscribe to the product will be + presented and required to accept these terms before they can complete the subscription process. + :paramtype terms: str + :keyword subscription_required: Whether a product subscription is required for accessing APIs + included in this product. If true, the product is referred to as "protected" and a valid + subscription key is required for a request to an API included in the product to succeed. If + false, the product is referred to as "open" and requests to an API included in the product can + be made without a subscription key. If property is omitted when creating a new product it's + value is assumed to be true. + :paramtype subscription_required: bool + :keyword approval_required: whether subscription approval is required. If false, new + subscriptions will be approved automatically enabling 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. + :paramtype approval_required: bool + :keyword 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. + :paramtype subscriptions_limit: int + :keyword state: whether product is published or not. Published products are discoverable by + users of developer portal. Non published products are visible only to administrators. Default + state of Product is notPublished. Possible values include: "notPublished", "published". + :paramtype state: str or ~azure.mgmt.apimanagement.models.ProductState + :keyword display_name: Product name. + :paramtype display_name: str + """ super(ProductUpdateProperties, self).__init__(description=description, terms=terms, subscription_required=subscription_required, approval_required=approval_required, subscriptions_limit=subscriptions_limit, state=state, **kwargs) self.display_name = display_name @@ -10504,12 +15083,12 @@ def __init__( class QuotaCounterCollection(msrest.serialization.Model): """Paged Quota Counter list representation. - :param value: Quota counter values. - :type value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Quota counter values. + :vartype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10526,6 +15105,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Quota counter values. + :paramtype value: list[~azure.mgmt.apimanagement.models.QuotaCounterContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(QuotaCounterCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -10537,19 +15124,19 @@ class QuotaCounterContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param counter_key: Required. The Key value of the Counter. Must not be empty. - :type counter_key: str - :param period_key: Required. Identifier of the Period for which the counter was collected. Must + :ivar counter_key: Required. The Key value of the Counter. Must not be empty. + :vartype counter_key: str + :ivar period_key: Required. Identifier of the Period for which the counter was collected. Must not be empty. - :type period_key: str - :param period_start_time: Required. The date of the start of Counter Period. The date conforms + :vartype period_key: str + :ivar period_start_time: Required. The date of the start of Counter Period. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type period_start_time: ~datetime.datetime - :param period_end_time: Required. The date of the end of Counter Period. The date conforms to + :vartype period_start_time: ~datetime.datetime + :ivar period_end_time: Required. The date of the end of Counter Period. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type period_end_time: ~datetime.datetime - :param value: Quota Value Properties. - :type value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + :vartype period_end_time: ~datetime.datetime + :ivar value: Quota Value Properties. + :vartype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties """ _validation = { @@ -10577,6 +15164,22 @@ def __init__( value: Optional["QuotaCounterValueContractProperties"] = None, **kwargs ): + """ + :keyword counter_key: Required. The Key value of the Counter. Must not be empty. + :paramtype counter_key: str + :keyword period_key: Required. Identifier of the Period for which the counter was collected. + Must not be empty. + :paramtype period_key: str + :keyword period_start_time: Required. The date of the start of Counter Period. The date + conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype period_start_time: ~datetime.datetime + :keyword period_end_time: Required. The date of the end of Counter Period. The date conforms to + the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype period_end_time: ~datetime.datetime + :keyword value: Quota Value Properties. + :paramtype value: ~azure.mgmt.apimanagement.models.QuotaCounterValueContractProperties + """ super(QuotaCounterContract, self).__init__(**kwargs) self.counter_key = counter_key self.period_key = period_key @@ -10588,10 +15191,10 @@ def __init__( class QuotaCounterValueContract(msrest.serialization.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 + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ _attribute_map = { @@ -10606,6 +15209,12 @@ def __init__( kb_transferred: Optional[float] = None, **kwargs ): + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ super(QuotaCounterValueContract, self).__init__(**kwargs) self.calls_count = calls_count self.kb_transferred = kb_transferred @@ -10614,10 +15223,10 @@ def __init__( class QuotaCounterValueContractProperties(msrest.serialization.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 + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ _attribute_map = { @@ -10632,6 +15241,12 @@ def __init__( kb_transferred: Optional[float] = None, **kwargs ): + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ super(QuotaCounterValueContractProperties, self).__init__(**kwargs) self.calls_count = calls_count self.kb_transferred = kb_transferred @@ -10640,10 +15255,10 @@ def __init__( class QuotaCounterValueUpdateContract(msrest.serialization.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 + :ivar calls_count: Number of times Counter was called. + :vartype calls_count: int + :ivar kb_transferred: Data Transferred in KiloBytes. + :vartype kb_transferred: float """ _attribute_map = { @@ -10658,6 +15273,12 @@ def __init__( kb_transferred: Optional[float] = None, **kwargs ): + """ + :keyword calls_count: Number of times Counter was called. + :paramtype calls_count: int + :keyword kb_transferred: Data Transferred in KiloBytes. + :paramtype kb_transferred: float + """ super(QuotaCounterValueUpdateContract, self).__init__(**kwargs) self.calls_count = calls_count self.kb_transferred = kb_transferred @@ -10666,12 +15287,12 @@ def __init__( class RecipientEmailCollection(msrest.serialization.Model): """Paged Recipient User list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10688,6 +15309,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientEmailContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(RecipientEmailCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -10699,14 +15328,16 @@ class RecipientEmailContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param email: User Email subscribed to notification. - :type email: str + :ivar email: User Email subscribed to notification. + :vartype email: str """ _validation = { @@ -10728,6 +15359,10 @@ def __init__( email: Optional[str] = None, **kwargs ): + """ + :keyword email: User Email subscribed to notification. + :paramtype email: str + """ super(RecipientEmailContract, self).__init__(**kwargs) self.email = email @@ -10735,10 +15370,10 @@ def __init__( class RecipientsContractProperties(msrest.serialization.Model): """Notification Parameter contract. - :param emails: List of Emails subscribed for the notification. - :type emails: list[str] - :param users: List of Users subscribed for the notification. - :type users: list[str] + :ivar emails: List of Emails subscribed for the notification. + :vartype emails: list[str] + :ivar users: List of Users subscribed for the notification. + :vartype users: list[str] """ _attribute_map = { @@ -10753,6 +15388,12 @@ def __init__( users: Optional[List[str]] = None, **kwargs ): + """ + :keyword emails: List of Emails subscribed for the notification. + :paramtype emails: list[str] + :keyword users: List of Users subscribed for the notification. + :paramtype users: list[str] + """ super(RecipientsContractProperties, self).__init__(**kwargs) self.emails = emails self.users = users @@ -10761,12 +15402,12 @@ def __init__( class RecipientUserCollection(msrest.serialization.Model): """Paged Recipient User list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10783,6 +15424,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RecipientUserContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(RecipientUserCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -10794,14 +15443,16 @@ class RecipientUserContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param user_id: API Management UserId subscribed to notification. - :type user_id: str + :ivar user_id: API Management UserId subscribed to notification. + :vartype user_id: str """ _validation = { @@ -10823,6 +15474,10 @@ def __init__( user_id: Optional[str] = None, **kwargs ): + """ + :keyword user_id: API Management UserId subscribed to notification. + :paramtype user_id: str + """ super(RecipientUserContract, self).__init__(**kwargs) self.user_id = user_id @@ -10834,10 +15489,10 @@ class RegionContract(msrest.serialization.Model): :ivar name: Region name. :vartype name: str - :param is_master_region: whether Region is the master region. - :type is_master_region: bool - :param is_deleted: whether Region is deleted. - :type is_deleted: bool + :ivar is_master_region: whether Region is the master region. + :vartype is_master_region: bool + :ivar is_deleted: whether Region is deleted. + :vartype is_deleted: bool """ _validation = { @@ -10857,6 +15512,12 @@ def __init__( is_deleted: Optional[bool] = None, **kwargs ): + """ + :keyword is_master_region: whether Region is the master region. + :paramtype is_master_region: bool + :keyword is_deleted: whether Region is deleted. + :paramtype is_deleted: bool + """ super(RegionContract, self).__init__(**kwargs) self.name = None self.is_master_region = is_master_region @@ -10866,12 +15527,12 @@ def __init__( class RegionListResult(msrest.serialization.Model): """Lists Regions operation response details. - :param value: Lists of Regions. - :type value: list[~azure.mgmt.apimanagement.models.RegionContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Lists of Regions. + :vartype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10888,6 +15549,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Lists of Regions. + :paramtype value: list[~azure.mgmt.apimanagement.models.RegionContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(RegionListResult, self).__init__(**kwargs) self.value = value self.count = count @@ -10897,8 +15566,8 @@ def __init__( class RegistrationDelegationSettingsProperties(msrest.serialization.Model): """User registration delegation settings properties. - :param enabled: Enable or disable delegation for user registration. - :type enabled: bool + :ivar enabled: Enable or disable delegation for user registration. + :vartype enabled: bool """ _attribute_map = { @@ -10911,19 +15580,95 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Enable or disable delegation for user registration. + :paramtype enabled: bool + """ super(RegistrationDelegationSettingsProperties, self).__init__(**kwargs) self.enabled = enabled +class RemotePrivateEndpointConnectionWrapper(msrest.serialization.Model): + """Remote Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Private Endpoint connection resource id. + :vartype id: str + :ivar name: Private Endpoint Connection Name. + :vartype name: str + :ivar type: Private Endpoint Connection Resource Type. + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + :vartype provisioning_state: str + :ivar group_ids: All the Group ids. + :vartype group_ids: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'group_ids': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'ArmIdWrapper'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'group_ids': {'key': 'properties.groupIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + private_endpoint: Optional["ArmIdWrapper"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword id: Private Endpoint connection resource id. + :paramtype id: str + :keyword name: Private Endpoint Connection Name. + :paramtype name: str + :keyword type: Private Endpoint Connection Resource Type. + :paramtype type: str + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.apimanagement.models.ArmIdWrapper + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.apimanagement.models.PrivateLinkServiceConnectionState + """ + super(RemotePrivateEndpointConnectionWrapper, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + self.group_ids = None + + class ReportCollection(msrest.serialization.Model): """Paged Report records list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -10940,6 +15685,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.ReportRecordContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(ReportCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -10951,67 +15704,67 @@ class ReportRecordContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Name depending on report endpoint specifies product, API, operation or developer + :ivar name: Name depending on report endpoint specifies product, API, operation or developer name. - :type name: str - :param timestamp: Start of aggregation period. The date conforms to the following format: + :vartype name: str + :ivar timestamp: Start of aggregation period. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type timestamp: ~datetime.datetime - :param interval: Length of aggregation period. Interval must be multiple of 15 minutes and may + :vartype timestamp: ~datetime.datetime + :ivar interval: Length of aggregation period. Interval must be multiple of 15 minutes and may not be zero. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations). - :type interval: str - :param country: Country to which this record data is related. - :type country: str - :param region: Country region to which this record data is related. - :type region: str - :param zip: Zip code to which this record data is related. - :type zip: str + :vartype interval: str + :ivar country: Country to which this record data is related. + :vartype country: str + :ivar region: Country region to which this record data is related. + :vartype region: str + :ivar zip: Zip code to which this record data is related. + :vartype zip: str :ivar user_id: User identifier path. /users/{userId}. :vartype user_id: str :ivar product_id: Product identifier path. /products/{productId}. :vartype product_id: str - :param api_id: API identifier path. /apis/{apiId}. - :type api_id: str - :param operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :type operation_id: str - :param api_region: API region identifier. - :type api_region: str - :param subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :type subscription_id: str - :param call_count_success: Number of successful calls. This includes calls returning + :ivar api_id: API identifier path. /apis/{apiId}. + :vartype api_id: str + :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :vartype operation_id: str + :ivar api_region: API region identifier. + :vartype api_region: str + :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :vartype subscription_id: str + :ivar call_count_success: Number of successful calls. This includes calls returning HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. - :type call_count_success: int - :param call_count_blocked: Number of calls blocked due to invalid credentials. This includes + :vartype call_count_success: int + :ivar call_count_blocked: Number of calls blocked due to invalid credentials. This includes calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and HttpStatusCode.TooManyRequests. - :type call_count_blocked: int - :param call_count_failed: Number of calls failed due to proxy or backend errors. This includes + :vartype call_count_blocked: int + :ivar call_count_failed: Number of calls failed due to proxy or backend errors. This includes calls returning HttpStatusCode.BadRequest(400) and any Code between HttpStatusCode.InternalServerError (500) and 600. - :type call_count_failed: int - :param call_count_other: Number of other calls. - :type call_count_other: int - :param call_count_total: Total number of calls. - :type call_count_total: int - :param bandwidth: Bandwidth consumed. - :type bandwidth: long - :param cache_hit_count: Number of times when content was served from cache policy. - :type cache_hit_count: int - :param cache_miss_count: Number of times content was fetched from backend. - :type cache_miss_count: int - :param api_time_avg: Average time it took to process request. - :type api_time_avg: float - :param api_time_min: Minimum time it took to process request. - :type api_time_min: float - :param api_time_max: Maximum time it took to process request. - :type api_time_max: float - :param service_time_avg: Average time it took to process request on backend. - :type service_time_avg: float - :param service_time_min: Minimum time it took to process request on backend. - :type service_time_min: float - :param service_time_max: Maximum time it took to process request on backend. - :type service_time_max: float + :vartype call_count_failed: int + :ivar call_count_other: Number of other calls. + :vartype call_count_other: int + :ivar call_count_total: Total number of calls. + :vartype call_count_total: int + :ivar bandwidth: Bandwidth consumed. + :vartype bandwidth: long + :ivar cache_hit_count: Number of times when content was served from cache policy. + :vartype cache_hit_count: int + :ivar cache_miss_count: Number of times content was fetched from backend. + :vartype cache_miss_count: int + :ivar api_time_avg: Average time it took to process request. + :vartype api_time_avg: float + :ivar api_time_min: Minimum time it took to process request. + :vartype api_time_min: float + :ivar api_time_max: Maximum time it took to process request. + :vartype api_time_max: float + :ivar service_time_avg: Average time it took to process request on backend. + :vartype service_time_avg: float + :ivar service_time_min: Minimum time it took to process request on backend. + :vartype service_time_min: float + :ivar service_time_max: Maximum time it took to process request on backend. + :vartype service_time_max: float """ _validation = { @@ -11077,6 +15830,65 @@ def __init__( service_time_max: Optional[float] = None, **kwargs ): + """ + :keyword name: Name depending on report endpoint specifies product, API, operation or developer + name. + :paramtype name: str + :keyword timestamp: Start of aggregation period. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype timestamp: ~datetime.datetime + :keyword interval: Length of aggregation period. Interval must be multiple of 15 minutes and + may not be zero. The value should be in ISO 8601 format + (http://en.wikipedia.org/wiki/ISO_8601#Durations). + :paramtype interval: str + :keyword country: Country to which this record data is related. + :paramtype country: str + :keyword region: Country region to which this record data is related. + :paramtype region: str + :keyword zip: Zip code to which this record data is related. + :paramtype zip: str + :keyword api_id: API identifier path. /apis/{apiId}. + :paramtype api_id: str + :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :paramtype operation_id: str + :keyword api_region: API region identifier. + :paramtype api_region: str + :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :paramtype subscription_id: str + :keyword call_count_success: Number of successful calls. This includes calls returning + HttpStatusCode <= 301 and HttpStatusCode.NotModified and HttpStatusCode.TemporaryRedirect. + :paramtype call_count_success: int + :keyword call_count_blocked: Number of calls blocked due to invalid credentials. This includes + calls returning HttpStatusCode.Unauthorized and HttpStatusCode.Forbidden and + HttpStatusCode.TooManyRequests. + :paramtype call_count_blocked: int + :keyword call_count_failed: Number of calls failed due to proxy or backend errors. This + includes calls returning HttpStatusCode.BadRequest(400) and any Code between + HttpStatusCode.InternalServerError (500) and 600. + :paramtype call_count_failed: int + :keyword call_count_other: Number of other calls. + :paramtype call_count_other: int + :keyword call_count_total: Total number of calls. + :paramtype call_count_total: int + :keyword bandwidth: Bandwidth consumed. + :paramtype bandwidth: long + :keyword cache_hit_count: Number of times when content was served from cache policy. + :paramtype cache_hit_count: int + :keyword cache_miss_count: Number of times content was fetched from backend. + :paramtype cache_miss_count: int + :keyword api_time_avg: Average time it took to process request. + :paramtype api_time_avg: float + :keyword api_time_min: Minimum time it took to process request. + :paramtype api_time_min: float + :keyword api_time_max: Maximum time it took to process request. + :paramtype api_time_max: float + :keyword service_time_avg: Average time it took to process request on backend. + :paramtype service_time_avg: float + :keyword service_time_min: Minimum time it took to process request on backend. + :paramtype service_time_min: float + :keyword service_time_max: Maximum time it took to process request on backend. + :paramtype service_time_max: float + """ super(ReportRecordContract, self).__init__(**kwargs) self.name = name self.timestamp = timestamp @@ -11111,20 +15923,20 @@ class RepresentationContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param content_type: Required. Specifies a registered or custom content type for this + :ivar content_type: Required. Specifies a registered or custom content type for this representation, e.g. application/xml. - :type content_type: str - :param sample: An example of the representation. - :type sample: str - :param schema_id: Schema identifier. Applicable only if 'contentType' value is neither + :vartype content_type: str + :ivar schema_id: Schema identifier. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :type schema_id: str - :param type_name: Type name defined by the schema. Applicable only if 'contentType' value is + :vartype schema_id: str + :ivar type_name: Type name defined by the schema. Applicable only if 'contentType' value is neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. - :type type_name: str - :param form_parameters: Collection of form parameters. Required if 'contentType' value is - either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. - :type form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :vartype type_name: str + :ivar form_parameters: Collection of form parameters. Required if 'contentType' value is either + 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + :vartype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar examples: Exampled defined for the representation. + :vartype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] """ _validation = { @@ -11133,41 +15945,57 @@ class RepresentationContract(msrest.serialization.Model): _attribute_map = { 'content_type': {'key': 'contentType', 'type': 'str'}, - 'sample': {'key': 'sample', 'type': 'str'}, 'schema_id': {'key': 'schemaId', 'type': 'str'}, 'type_name': {'key': 'typeName', 'type': 'str'}, 'form_parameters': {'key': 'formParameters', 'type': '[ParameterContract]'}, + 'examples': {'key': 'examples', 'type': '{ParameterExampleContract}'}, } def __init__( self, *, content_type: str, - sample: Optional[str] = None, schema_id: Optional[str] = None, type_name: Optional[str] = None, form_parameters: Optional[List["ParameterContract"]] = None, - **kwargs - ): + examples: Optional[Dict[str, "ParameterExampleContract"]] = None, + **kwargs + ): + """ + :keyword content_type: Required. Specifies a registered or custom content type for this + representation, e.g. application/xml. + :paramtype content_type: str + :keyword schema_id: Schema identifier. Applicable only if 'contentType' value is neither + 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :paramtype schema_id: str + :keyword type_name: Type name defined by the schema. Applicable only if 'contentType' value is + neither 'application/x-www-form-urlencoded' nor 'multipart/form-data'. + :paramtype type_name: str + :keyword form_parameters: Collection of form parameters. Required if 'contentType' value is + either 'application/x-www-form-urlencoded' or 'multipart/form-data'.. + :paramtype form_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword examples: Exampled defined for the representation. + :paramtype examples: dict[str, ~azure.mgmt.apimanagement.models.ParameterExampleContract] + """ super(RepresentationContract, self).__init__(**kwargs) self.content_type = content_type - self.sample = sample self.schema_id = schema_id self.type_name = type_name self.form_parameters = form_parameters + self.examples = examples class RequestContract(msrest.serialization.Model): """Operation request details. - :param description: Operation request description. - :type description: str - :param query_parameters: Collection of operation request query parameters. - :type query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param headers: Collection of operation request headers. - :type headers: list[~azure.mgmt.apimanagement.models.ParameterContract] - :param representations: Collection of operation request representations. - :type representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + :ivar description: Operation request description. + :vartype description: str + :ivar query_parameters: Collection of operation request query parameters. + :vartype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar headers: Collection of operation request headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar representations: Collection of operation request representations. + :vartype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] """ _attribute_map = { @@ -11186,6 +16014,16 @@ def __init__( representations: Optional[List["RepresentationContract"]] = None, **kwargs ): + """ + :keyword description: Operation request description. + :paramtype description: str + :keyword query_parameters: Collection of operation request query parameters. + :paramtype query_parameters: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword headers: Collection of operation request headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :keyword representations: Collection of operation request representations. + :paramtype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + """ super(RequestContract, self).__init__(**kwargs) self.description = description self.query_parameters = query_parameters @@ -11196,10 +16034,10 @@ def __init__( class RequestReportCollection(msrest.serialization.Model): """Paged Report records list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] - :param count: Total record count number across all pages. - :type count: long + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] + :ivar count: Total record count number across all pages. + :vartype count: long """ _attribute_map = { @@ -11214,6 +16052,12 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.RequestReportRecordContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + """ super(RequestReportCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -11224,48 +16068,48 @@ class RequestReportRecordContract(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param api_id: API identifier path. /apis/{apiId}. - :type api_id: str - :param operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. - :type operation_id: str + :ivar api_id: API identifier path. /apis/{apiId}. + :vartype api_id: str + :ivar operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :vartype operation_id: str :ivar product_id: Product identifier path. /products/{productId}. :vartype product_id: str :ivar user_id: User identifier path. /users/{userId}. :vartype user_id: str - :param method: The HTTP method associated with this request.. - :type method: str - :param url: The full URL associated with this request. - :type url: str - :param ip_address: The client IP address associated with this request. - :type ip_address: str - :param backend_response_code: The HTTP status code received by the gateway as a result of + :ivar method: The HTTP method associated with this request.. + :vartype method: str + :ivar url: The full URL associated with this request. + :vartype url: str + :ivar ip_address: The client IP address associated with this request. + :vartype ip_address: str + :ivar backend_response_code: The HTTP status code received by the gateway as a result of forwarding this request to the backend. - :type backend_response_code: str - :param response_code: The HTTP status code returned by the gateway. - :type response_code: int - :param response_size: The size of the response returned by the gateway. - :type response_size: int - :param timestamp: The date and time when this request was received by the gateway in ISO 8601 + :vartype backend_response_code: str + :ivar response_code: The HTTP status code returned by the gateway. + :vartype response_code: int + :ivar response_size: The size of the response returned by the gateway. + :vartype response_size: int + :ivar timestamp: The date and time when this request was received by the gateway in ISO 8601 format. - :type timestamp: ~datetime.datetime - :param cache: Specifies if response cache was involved in generating the response. If the value + :vartype timestamp: ~datetime.datetime + :ivar cache: Specifies if response cache was involved in generating the response. If the value is none, the cache was not used. If the value is hit, cached response was returned. If the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled by the backend. - :type cache: str - :param api_time: The total time it took to process this request. - :type api_time: float - :param service_time: he time it took to forward this request to the backend and get the - response back. - :type service_time: float - :param api_region: Azure region where the gateway that processed this request is located. - :type api_region: str - :param subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. - :type subscription_id: str - :param request_id: Request Identifier. - :type request_id: str - :param request_size: The size of this request.. - :type request_size: int + :vartype cache: str + :ivar api_time: The total time it took to process this request. + :vartype api_time: float + :ivar service_time: he time it took to forward this request to the backend and get the response + back. + :vartype service_time: float + :ivar api_region: Azure region where the gateway that processed this request is located. + :vartype api_region: str + :ivar subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :vartype subscription_id: str + :ivar request_id: Request Identifier. + :vartype request_id: str + :ivar request_size: The size of this request.. + :vartype request_size: int """ _validation = { @@ -11315,6 +16159,46 @@ def __init__( request_size: Optional[int] = None, **kwargs ): + """ + :keyword api_id: API identifier path. /apis/{apiId}. + :paramtype api_id: str + :keyword operation_id: Operation identifier path. /apis/{apiId}/operations/{operationId}. + :paramtype operation_id: str + :keyword method: The HTTP method associated with this request.. + :paramtype method: str + :keyword url: The full URL associated with this request. + :paramtype url: str + :keyword ip_address: The client IP address associated with this request. + :paramtype ip_address: str + :keyword backend_response_code: The HTTP status code received by the gateway as a result of + forwarding this request to the backend. + :paramtype backend_response_code: str + :keyword response_code: The HTTP status code returned by the gateway. + :paramtype response_code: int + :keyword response_size: The size of the response returned by the gateway. + :paramtype response_size: int + :keyword timestamp: The date and time when this request was received by the gateway in ISO 8601 + format. + :paramtype timestamp: ~datetime.datetime + :keyword cache: Specifies if response cache was involved in generating the response. If the + value is none, the cache was not used. If the value is hit, cached response was returned. If + the value is miss, the cache was used but lookup resulted in a miss and request was fulfilled + by the backend. + :paramtype cache: str + :keyword api_time: The total time it took to process this request. + :paramtype api_time: float + :keyword service_time: he time it took to forward this request to the backend and get the + response back. + :paramtype service_time: float + :keyword api_region: Azure region where the gateway that processed this request is located. + :paramtype api_region: str + :keyword subscription_id: Subscription identifier path. /subscriptions/{subscriptionId}. + :paramtype subscription_id: str + :keyword request_id: Request Identifier. + :paramtype request_id: str + :keyword request_size: The size of this request.. + :paramtype request_size: int + """ super(RequestReportRecordContract, self).__init__(**kwargs) self.api_id = api_id self.operation_id = operation_id @@ -11341,14 +16225,14 @@ class ResourceLocationDataContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. A canonical name for the geographic or physical location. - :type name: str - :param city: The city or locality where the resource is located. - :type city: str - :param district: The district, state, or province where the resource is located. - :type district: str - :param country_or_region: The country or region where the resource is located. - :type country_or_region: str + :ivar name: Required. A canonical name for the geographic or physical location. + :vartype name: str + :ivar city: The city or locality where the resource is located. + :vartype city: str + :ivar district: The district, state, or province where the resource is located. + :vartype district: str + :ivar country_or_region: The country or region where the resource is located. + :vartype country_or_region: str """ _validation = { @@ -11374,6 +16258,16 @@ def __init__( country_or_region: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. A canonical name for the geographic or physical location. + :paramtype name: str + :keyword city: The city or locality where the resource is located. + :paramtype city: str + :keyword district: The district, state, or province where the resource is located. + :paramtype district: str + :keyword country_or_region: The country or region where the resource is located. + :paramtype country_or_region: str + """ super(ResourceLocationDataContract, self).__init__(**kwargs) self.name = name self.city = city @@ -11384,9 +16278,9 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available API Management SKU. - :param name: Name of the Sku. Possible values include: "Developer", "Standard", "Premium", + :ivar name: Name of the Sku. Possible values include: "Developer", "Standard", "Premium", "Basic", "Consumption", "Isolated". - :type name: str or ~azure.mgmt.apimanagement.models.SkuType + :vartype name: str or ~azure.mgmt.apimanagement.models.SkuType """ _attribute_map = { @@ -11399,6 +16293,11 @@ def __init__( name: Optional[Union[str, "SkuType"]] = None, **kwargs ): + """ + :keyword name: Name of the Sku. Possible values include: "Developer", "Standard", "Premium", + "Basic", "Consumption", "Isolated". + :paramtype name: str or ~azure.mgmt.apimanagement.models.SkuType + """ super(ResourceSku, self).__init__(**kwargs) self.name = name @@ -11437,6 +16336,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuCapacity, self).__init__(**kwargs) self.minimum = None self.maximum = None @@ -11473,6 +16374,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceSkuResult, self).__init__(**kwargs) self.resource_type = None self.sku = None @@ -11484,10 +16387,10 @@ class ResourceSkuResults(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the service. - :type value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] - :param next_link: The uri to fetch the next page of API Management service Skus. - :type next_link: str + :ivar value: Required. The list of skus available for the service. + :vartype value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] + :ivar next_link: The uri to fetch the next page of API Management service Skus. + :vartype next_link: str """ _validation = { @@ -11506,6 +16409,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. The list of skus available for the service. + :paramtype value: list[~azure.mgmt.apimanagement.models.ResourceSkuResult] + :keyword next_link: The uri to fetch the next page of API Management service Skus. + :paramtype next_link: str + """ super(ResourceSkuResults, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -11516,14 +16425,14 @@ class ResponseContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status_code: Required. Operation response HTTP status code. - :type status_code: int - :param description: Operation response description. - :type description: str - :param representations: Collection of operation response representations. - :type representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] - :param headers: Collection of operation response headers. - :type headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + :ivar status_code: Required. Operation response HTTP status code. + :vartype status_code: int + :ivar description: Operation response description. + :vartype description: str + :ivar representations: Collection of operation response representations. + :vartype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + :ivar headers: Collection of operation response headers. + :vartype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] """ _validation = { @@ -11546,6 +16455,16 @@ def __init__( headers: Optional[List["ParameterContract"]] = None, **kwargs ): + """ + :keyword status_code: Required. Operation response HTTP status code. + :paramtype status_code: int + :keyword description: Operation response description. + :paramtype description: str + :keyword representations: Collection of operation response representations. + :paramtype representations: list[~azure.mgmt.apimanagement.models.RepresentationContract] + :keyword headers: Collection of operation response headers. + :paramtype headers: list[~azure.mgmt.apimanagement.models.ParameterContract] + """ super(ResponseContract, self).__init__(**kwargs) self.status_code = status_code self.description = description @@ -11556,10 +16475,10 @@ def __init__( class SamplingSettings(msrest.serialization.Model): """Sampling settings for Diagnostic. - :param sampling_type: Sampling type. Possible values include: "fixed". - :type sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType - :param percentage: Rate of sampling for fixed-rate sampling. - :type percentage: float + :ivar sampling_type: Sampling type. Possible values include: "fixed". + :vartype sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType + :ivar percentage: Rate of sampling for fixed-rate sampling. + :vartype percentage: float """ _validation = { @@ -11578,6 +16497,12 @@ def __init__( percentage: Optional[float] = None, **kwargs ): + """ + :keyword sampling_type: Sampling type. Possible values include: "fixed". + :paramtype sampling_type: str or ~azure.mgmt.apimanagement.models.SamplingType + :keyword percentage: Rate of sampling for fixed-rate sampling. + :paramtype percentage: float + """ super(SamplingSettings, self).__init__(**kwargs) self.sampling_type = sampling_type self.percentage = percentage @@ -11586,12 +16511,11 @@ def __init__( class SaveConfigurationParameter(msrest.serialization.Model): """Save Tenant Configuration Contract details. - :param branch: The name of the Git branch in which to commit the current configuration - snapshot. - :type branch: str - :param force: The value if true, the current configuration database is committed to the Git + :ivar branch: The name of the Git branch in which to commit the current configuration snapshot. + :vartype branch: str + :ivar force: The value if true, the current configuration database is committed to the Git repository, even if the Git repository has newer changes that would be overwritten. - :type force: bool + :vartype force: bool """ _attribute_map = { @@ -11606,6 +16530,14 @@ def __init__( force: Optional[bool] = None, **kwargs ): + """ + :keyword branch: The name of the Git branch in which to commit the current configuration + snapshot. + :paramtype branch: str + :keyword force: The value if true, the current configuration database is committed to the Git + repository, even if the Git repository has newer changes that would be overwritten. + :paramtype force: bool + """ super(SaveConfigurationParameter, self).__init__(**kwargs) self.branch = branch self.force = force @@ -11616,10 +16548,10 @@ class SchemaCollection(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Api Schema Contract value. + :ivar value: API Schema Contract value. :vartype value: list[~azure.mgmt.apimanagement.models.SchemaContract] - :param count: Total record count number. - :type count: long + :ivar count: Total record count number. + :vartype count: long :ivar next_link: Next page link if any. :vartype next_link: str """ @@ -11641,6 +16573,10 @@ def __init__( count: Optional[int] = None, **kwargs ): + """ + :keyword count: Total record count number. + :paramtype count: long + """ super(SchemaCollection, self).__init__(**kwargs) self.value = None self.count = count @@ -11648,28 +16584,33 @@ def __init__( class SchemaContract(Resource): - """Schema Contract details. + """API Schema Contract details. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param content_type: Must be a valid a media type used in a Content-Type header as defined in + :ivar content_type: Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- ``Swagger`` Schema use ``application/vnd.ms-azure-apim.swagger.definitions+json``
- ``WSDL`` Schema use ``application/vnd.ms-azure-apim.xsd+xml``
- ``OpenApi`` Schema use ``application/vnd.oai.openapi.components+json``
- ``WADL Schema`` use ``application/vnd.ms-azure-apim.wadl.grammars+xml``. - :type content_type: str - :param value: Json escaped string defining the document representing the Schema. Used for + :vartype content_type: str + :ivar value: Json escaped string defining the document representing the Schema. Used for schemas other than Swagger/OpenAPI. - :type value: str - :param definitions: Types definitions. Used for Swagger/OpenAPI schemas only, null otherwise. - :type definitions: any + :vartype value: str + :ivar definitions: Types definitions. Used for Swagger/OpenAPI v1 schemas only, null otherwise. + :vartype definitions: any + :ivar components: Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null + otherwise. + :vartype components: any """ _validation = { @@ -11685,6 +16626,7 @@ class SchemaContract(Resource): 'content_type': {'key': 'properties.contentType', 'type': 'str'}, 'value': {'key': 'properties.document.value', 'type': 'str'}, 'definitions': {'key': 'properties.document.definitions', 'type': 'object'}, + 'components': {'key': 'properties.document.components', 'type': 'object'}, } def __init__( @@ -11693,23 +16635,43 @@ def __init__( content_type: Optional[str] = None, value: Optional[str] = None, definitions: Optional[Any] = None, - **kwargs - ): + components: Optional[Any] = None, + **kwargs + ): + """ + :keyword content_type: Must be a valid a media type used in a Content-Type header as defined in + the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
+ - ``Swagger`` Schema use ``application/vnd.ms-azure-apim.swagger.definitions+json``
- + ``WSDL`` Schema use ``application/vnd.ms-azure-apim.xsd+xml``
- ``OpenApi`` Schema use + ``application/vnd.oai.openapi.components+json``
- ``WADL Schema`` use + ``application/vnd.ms-azure-apim.wadl.grammars+xml``. + :paramtype content_type: str + :keyword value: Json escaped string defining the document representing the Schema. Used for + schemas other than Swagger/OpenAPI. + :paramtype value: str + :keyword definitions: Types definitions. Used for Swagger/OpenAPI v1 schemas only, null + otherwise. + :paramtype definitions: any + :keyword components: Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only, null + otherwise. + :paramtype components: any + """ super(SchemaContract, self).__init__(**kwargs) self.content_type = content_type self.value = value self.definitions = definitions + self.components = components class SubscriptionCollection(msrest.serialization.Model): """Paged Subscriptions list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -11726,6 +16688,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.SubscriptionContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(SubscriptionCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -11737,20 +16707,22 @@ class SubscriptionContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param owner_id: The user resource identifier of the subscription owner. The value is a valid + :ivar owner_id: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier. - :type owner_id: str - :param scope: Scope like /products/{productId} or /apis or /apis/{apiId}. - :type scope: str - :param display_name: The name of the subscription, or null if the subscription has no name. - :type display_name: str - :param state: Subscription state. Possible states are * active – the subscription is active, * + :vartype owner_id: str + :ivar scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :vartype scope: str + :ivar display_name: The name of the subscription, or null if the subscription has no name. + :vartype display_name: str + :ivar state: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an @@ -11758,39 +16730,39 @@ class SubscriptionContract(Resource): administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: "suspended", "active", "expired", "submitted", "rejected", "cancelled". - :type state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :vartype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState :ivar created_date: Subscription creation date. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. :vartype created_date: ~datetime.datetime - :param start_date: Subscription activation date. The setting is for audit purposes only and the + :ivar start_date: Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type start_date: ~datetime.datetime - :param expiration_date: Subscription expiration date. The setting is for audit purposes only - and the subscription is not automatically expired. The subscription lifecycle can be managed by + :vartype start_date: ~datetime.datetime + :ivar expiration_date: Subscription expiration date. The setting is for audit purposes only and + the subscription is not automatically expired. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiration_date: ~datetime.datetime - :param end_date: Date when subscription was cancelled or expired. The setting is for audit + :vartype expiration_date: ~datetime.datetime + :ivar end_date: Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type end_date: ~datetime.datetime - :param notification_date: Upcoming subscription expiration notification date. The date conforms + :vartype end_date: ~datetime.datetime + :ivar notification_date: Upcoming subscription expiration notification date. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type notification_date: ~datetime.datetime - :param primary_key: Subscription primary key. This property will not be filled on 'GET' + :vartype notification_date: ~datetime.datetime + :ivar primary_key: Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type primary_key: str - :param secondary_key: Subscription secondary key. This property will not be filled on 'GET' + :vartype primary_key: str + :ivar secondary_key: Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. - :type secondary_key: str - :param state_comment: Optional subscription comment added by an administrator when the state is + :vartype secondary_key: str + :ivar state_comment: Optional subscription comment added by an 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 + :vartype state_comment: str + :ivar allow_tracing: Determines whether tracing is enabled. + :vartype allow_tracing: bool """ _validation = { @@ -11839,6 +16811,54 @@ def __init__( allow_tracing: Optional[bool] = None, **kwargs ): + """ + :keyword owner_id: The user resource identifier of the subscription owner. The value is a valid + relative URL in the format of /users/{userId} where {userId} is a user identifier. + :paramtype owner_id: str + :keyword scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :paramtype scope: str + :keyword display_name: The name of the subscription, or null if the subscription has no name. + :paramtype display_name: str + :keyword state: Subscription state. Possible states are * active – the subscription is active, + * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the + product, * submitted – the subscription request has been made by the developer, but has not yet + been approved or rejected, * rejected – the subscription request has been denied by an + administrator, * cancelled – the subscription has been cancelled by the developer or + administrator, * expired – the subscription reached its expiration date and was deactivated. + Possible values include: "suspended", "active", "expired", "submitted", "rejected", + "cancelled". + :paramtype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :keyword start_date: Subscription activation date. The setting is for audit purposes only and + the subscription is not automatically activated. The subscription lifecycle can be managed by + using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype start_date: ~datetime.datetime + :keyword expiration_date: Subscription expiration date. The setting is for audit purposes only + and the subscription is not automatically expired. The subscription lifecycle can be managed by + using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiration_date: ~datetime.datetime + :keyword end_date: Date when subscription was cancelled or expired. The setting is for audit + purposes only and the subscription is not automatically cancelled. The subscription lifecycle + can be managed by using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype end_date: ~datetime.datetime + :keyword notification_date: Upcoming subscription expiration notification date. The date + conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype notification_date: ~datetime.datetime + :keyword primary_key: Subscription primary key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype primary_key: str + :keyword secondary_key: Subscription secondary key. This property will not be filled on 'GET' + operations! Use '/listSecrets' POST request to get the value. + :paramtype secondary_key: str + :keyword state_comment: Optional subscription comment added by an administrator when the state + is changed to the 'rejected'. + :paramtype state_comment: str + :keyword allow_tracing: Determines whether tracing is enabled. + :paramtype allow_tracing: bool + """ super(SubscriptionContract, self).__init__(**kwargs) self.owner_id = owner_id self.scope = scope @@ -11858,31 +16878,30 @@ def __init__( class SubscriptionCreateParameters(msrest.serialization.Model): """Subscription create details. - :param owner_id: User (user id path) for whom subscription is being created in form + :ivar owner_id: User (user id path) for whom subscription is being created in form /users/{userId}. - :type owner_id: str - :param scope: Scope like /products/{productId} or /apis or /apis/{apiId}. - :type scope: str - :param display_name: Subscription name. - :type display_name: str - :param primary_key: Primary subscription key. If not specified during request key will be + :vartype owner_id: str + :ivar scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :vartype scope: str + :ivar display_name: Subscription name. + :vartype display_name: str + :ivar primary_key: Primary subscription key. If not specified during request key will be generated automatically. - :type primary_key: str - :param secondary_key: Secondary subscription key. If not specified during request key will be + :vartype primary_key: str + :ivar secondary_key: Secondary subscription key. If not specified during request key will be generated automatically. - :type secondary_key: str - :param state: Initial subscription state. If no value is specified, subscription is created - with Submitted state. Possible states are * active – the subscription is active, * suspended – - the subscription is blocked, and the subscriber cannot call any APIs of the product, * - submitted – the subscription request has been made by the developer, but has not yet been - approved or rejected, * rejected – the subscription request has been denied by an - administrator, * cancelled – the subscription has been cancelled by the developer or - administrator, * expired – the subscription reached its expiration date and was deactivated. - Possible values include: "suspended", "active", "expired", "submitted", "rejected", - "cancelled". - :type state: str or ~azure.mgmt.apimanagement.models.SubscriptionState - :param allow_tracing: Determines whether tracing can be enabled. - :type allow_tracing: bool + :vartype secondary_key: str + :ivar state: Initial subscription state. If no value is specified, subscription is created with + Submitted state. Possible states are * active – the subscription is active, * suspended – the + subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – + the subscription request has been made by the developer, but has not yet been approved or + rejected, * rejected – the subscription request has been denied by an administrator, * + cancelled – the subscription has been cancelled by the developer or administrator, * expired – + the subscription reached its expiration date and was deactivated. Possible values include: + "suspended", "active", "expired", "submitted", "rejected", "cancelled". + :vartype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :ivar allow_tracing: Determines whether tracing can be enabled. + :vartype allow_tracing: bool """ _validation = { @@ -11913,6 +16932,33 @@ def __init__( allow_tracing: Optional[bool] = None, **kwargs ): + """ + :keyword owner_id: User (user id path) for whom subscription is being created in form + /users/{userId}. + :paramtype owner_id: str + :keyword scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :paramtype scope: str + :keyword display_name: Subscription name. + :paramtype display_name: str + :keyword primary_key: Primary subscription key. If not specified during request key will be + generated automatically. + :paramtype primary_key: str + :keyword secondary_key: Secondary subscription key. If not specified during request key will be + generated automatically. + :paramtype secondary_key: str + :keyword state: Initial subscription state. If no value is specified, subscription is created + with Submitted state. Possible states are * active – the subscription is active, * suspended – + the subscription is blocked, and the subscriber cannot call any APIs of the product, * + submitted – the subscription request has been made by the developer, but has not yet been + approved or rejected, * rejected – the subscription request has been denied by an + administrator, * cancelled – the subscription has been cancelled by the developer or + administrator, * expired – the subscription reached its expiration date and was deactivated. + Possible values include: "suspended", "active", "expired", "submitted", "rejected", + "cancelled". + :paramtype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :keyword allow_tracing: Determines whether tracing can be enabled. + :paramtype allow_tracing: bool + """ super(SubscriptionCreateParameters, self).__init__(**kwargs) self.owner_id = owner_id self.scope = scope @@ -11926,10 +16972,10 @@ def __init__( class SubscriptionKeyParameterNamesContract(msrest.serialization.Model): """Subscription key parameter names details. - :param header: Subscription key header name. - :type header: str - :param query: Subscription key query string parameter name. - :type query: str + :ivar header: Subscription key header name. + :vartype header: str + :ivar query: Subscription key query string parameter name. + :vartype query: str """ _attribute_map = { @@ -11944,6 +16990,12 @@ def __init__( query: Optional[str] = None, **kwargs ): + """ + :keyword header: Subscription key header name. + :paramtype header: str + :keyword query: Subscription key query string parameter name. + :paramtype query: str + """ super(SubscriptionKeyParameterNamesContract, self).__init__(**kwargs) self.header = header self.query = query @@ -11952,10 +17004,10 @@ def __init__( class SubscriptionKeysContract(msrest.serialization.Model): """Subscription keys. - :param primary_key: Subscription primary key. - :type primary_key: str - :param secondary_key: Subscription secondary key. - :type secondary_key: str + :ivar primary_key: Subscription primary key. + :vartype primary_key: str + :ivar secondary_key: Subscription secondary key. + :vartype secondary_key: str """ _validation = { @@ -11975,6 +17027,12 @@ def __init__( secondary_key: Optional[str] = None, **kwargs ): + """ + :keyword primary_key: Subscription primary key. + :paramtype primary_key: str + :keyword secondary_key: Subscription secondary key. + :paramtype secondary_key: str + """ super(SubscriptionKeysContract, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -11983,8 +17041,8 @@ def __init__( class SubscriptionsDelegationSettingsProperties(msrest.serialization.Model): """Subscriptions delegation settings properties. - :param enabled: Enable or disable delegation for subscriptions. - :type enabled: bool + :ivar enabled: Enable or disable delegation for subscriptions. + :vartype enabled: bool """ _attribute_map = { @@ -11997,6 +17055,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Enable or disable delegation for subscriptions. + :paramtype enabled: bool + """ super(SubscriptionsDelegationSettingsProperties, self).__init__(**kwargs) self.enabled = enabled @@ -12004,22 +17066,22 @@ def __init__( class SubscriptionUpdateParameters(msrest.serialization.Model): """Subscription update details. - :param owner_id: User identifier path: /users/{userId}. - :type owner_id: str - :param scope: Scope like /products/{productId} or /apis or /apis/{apiId}. - :type scope: str - :param expiration_date: Subscription expiration date. The setting is for audit purposes only - and the subscription is not automatically expired. The subscription lifecycle can be managed by + :ivar owner_id: User identifier path: /users/{userId}. + :vartype owner_id: str + :ivar scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :vartype scope: str + :ivar expiration_date: Subscription expiration date. The setting is for audit purposes only and + the subscription is not automatically expired. The subscription lifecycle can be managed by using the ``state`` property. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiration_date: ~datetime.datetime - :param display_name: Subscription name. - :type display_name: str - :param primary_key: Primary subscription key. - :type primary_key: str - :param secondary_key: Secondary subscription key. - :type secondary_key: str - :param state: Subscription state. Possible states are * active – the subscription is active, * + :vartype expiration_date: ~datetime.datetime + :ivar display_name: Subscription name. + :vartype display_name: str + :ivar primary_key: Primary subscription key. + :vartype primary_key: str + :ivar secondary_key: Secondary subscription key. + :vartype secondary_key: str + :ivar state: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an @@ -12027,12 +17089,12 @@ class SubscriptionUpdateParameters(msrest.serialization.Model): administrator, * expired – the subscription reached its expiration date and was deactivated. Possible values include: "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 when + :vartype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :ivar state_comment: Comments describing subscription state change by the 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 + :vartype state_comment: str + :ivar allow_tracing: Determines whether tracing can be enabled. + :vartype allow_tracing: bool """ _validation = { @@ -12066,6 +17128,37 @@ def __init__( allow_tracing: Optional[bool] = None, **kwargs ): + """ + :keyword owner_id: User identifier path: /users/{userId}. + :paramtype owner_id: str + :keyword scope: Scope like /products/{productId} or /apis or /apis/{apiId}. + :paramtype scope: str + :keyword expiration_date: Subscription expiration date. The setting is for audit purposes only + and the subscription is not automatically expired. The subscription lifecycle can be managed by + using the ``state`` property. The date conforms to the following format: + ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype expiration_date: ~datetime.datetime + :keyword display_name: Subscription name. + :paramtype display_name: str + :keyword primary_key: Primary subscription key. + :paramtype primary_key: str + :keyword secondary_key: Secondary subscription key. + :paramtype secondary_key: str + :keyword state: Subscription state. Possible states are * active – the subscription is active, + * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the + product, * submitted – the subscription request has been made by the developer, but has not yet + been approved or rejected, * rejected – the subscription request has been denied by an + administrator, * cancelled – the subscription has been cancelled by the developer or + administrator, * expired – the subscription reached its expiration date and was deactivated. + Possible values include: "suspended", "active", "expired", "submitted", "rejected", + "cancelled". + :paramtype state: str or ~azure.mgmt.apimanagement.models.SubscriptionState + :keyword state_comment: Comments describing subscription state change by the administrator when + the state is changed to the 'rejected'. + :paramtype state_comment: str + :keyword allow_tracing: Determines whether tracing can be enabled. + :paramtype allow_tracing: bool + """ super(SubscriptionUpdateParameters, self).__init__(**kwargs) self.owner_id = owner_id self.scope = scope @@ -12078,15 +17171,79 @@ def __init__( self.allow_tracing = allow_tracing +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.apimanagement.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + class TagCollection(msrest.serialization.Model): """Paged Tag list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.TagContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.TagContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -12103,6 +17260,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.TagContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(TagCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -12114,14 +17279,16 @@ class TagContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param display_name: Tag name. - :type display_name: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -12144,6 +17311,10 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagContract, self).__init__(**kwargs) self.display_name = display_name @@ -12151,8 +17322,8 @@ def __init__( class TagCreateUpdateParameters(msrest.serialization.Model): """Parameters supplied to Create/Update Tag operations. - :param display_name: Tag name. - :type display_name: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -12169,6 +17340,10 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagCreateUpdateParameters, self).__init__(**kwargs) self.display_name = display_name @@ -12176,12 +17351,12 @@ def __init__( class TagDescriptionBaseProperties(msrest.serialization.Model): """Parameters supplied to the Create TagDescription operation. - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str """ _validation = { @@ -12202,6 +17377,14 @@ def __init__( external_docs_description: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + """ super(TagDescriptionBaseProperties, self).__init__(**kwargs) self.description = description self.external_docs_url = external_docs_url @@ -12211,12 +17394,12 @@ def __init__( class TagDescriptionCollection(msrest.serialization.Model): """Paged TagDescription list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -12233,6 +17416,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.TagDescriptionContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(TagDescriptionCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -12244,22 +17435,24 @@ class TagDescriptionContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str - :param tag_id: Identifier of the tag in the form of /tags/{tagId}. - :type tag_id: str - :param display_name: Tag name. - :type display_name: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str + :ivar tag_id: Identifier of the tag in the form of /tags/{tagId}. + :vartype tag_id: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -12291,6 +17484,18 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + :keyword tag_id: Identifier of the tag in the form of /tags/{tagId}. + :paramtype tag_id: str + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagDescriptionContract, self).__init__(**kwargs) self.description = description self.external_docs_url = external_docs_url @@ -12302,16 +17507,16 @@ def __init__( class TagDescriptionContractProperties(TagDescriptionBaseProperties): """TagDescription contract Properties. - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str - :param tag_id: Identifier of the tag in the form of /tags/{tagId}. - :type tag_id: str - :param display_name: Tag name. - :type display_name: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str + :ivar tag_id: Identifier of the tag in the form of /tags/{tagId}. + :vartype tag_id: str + :ivar display_name: Tag name. + :vartype display_name: str """ _validation = { @@ -12337,6 +17542,18 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + :keyword tag_id: Identifier of the tag in the form of /tags/{tagId}. + :paramtype tag_id: str + :keyword display_name: Tag name. + :paramtype display_name: str + """ super(TagDescriptionContractProperties, self).__init__(description=description, external_docs_url=external_docs_url, external_docs_description=external_docs_description, **kwargs) self.tag_id = tag_id self.display_name = display_name @@ -12345,12 +17562,12 @@ def __init__( class TagDescriptionCreateParameters(msrest.serialization.Model): """Parameters supplied to the Create TagDescription operation. - :param description: Description of the Tag. - :type description: str - :param external_docs_url: Absolute URL of external resources describing the tag. - :type external_docs_url: str - :param external_docs_description: Description of the external resources describing the tag. - :type external_docs_description: str + :ivar description: Description of the Tag. + :vartype description: str + :ivar external_docs_url: Absolute URL of external resources describing the tag. + :vartype external_docs_url: str + :ivar external_docs_description: Description of the external resources describing the tag. + :vartype external_docs_description: str """ _validation = { @@ -12371,6 +17588,14 @@ def __init__( external_docs_description: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the Tag. + :paramtype description: str + :keyword external_docs_url: Absolute URL of external resources describing the tag. + :paramtype external_docs_url: str + :keyword external_docs_description: Description of the external resources describing the tag. + :paramtype external_docs_description: str + """ super(TagDescriptionCreateParameters, self).__init__(**kwargs) self.description = description self.external_docs_url = external_docs_url @@ -12380,12 +17605,12 @@ def __init__( class TagResourceCollection(msrest.serialization.Model): """Paged Tag list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.TagResourceContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.TagResourceContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -12402,6 +17627,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.TagResourceContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(TagResourceCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -12413,14 +17646,14 @@ class TagResourceContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tag: Required. Tag associated with the resource. - :type tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties - :param api: Api associated with the tag. - :type api: ~azure.mgmt.apimanagement.models.ApiTagResourceContractProperties - :param operation: Operation associated with the tag. - :type operation: ~azure.mgmt.apimanagement.models.OperationTagResourceContractProperties - :param product: Product associated with the tag. - :type product: ~azure.mgmt.apimanagement.models.ProductTagResourceContractProperties + :ivar tag: Required. Tag associated with the resource. + :vartype tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties + :ivar api: API associated with the tag. + :vartype api: ~azure.mgmt.apimanagement.models.ApiTagResourceContractProperties + :ivar operation: Operation associated with the tag. + :vartype operation: ~azure.mgmt.apimanagement.models.OperationTagResourceContractProperties + :ivar product: Product associated with the tag. + :vartype product: ~azure.mgmt.apimanagement.models.ProductTagResourceContractProperties """ _validation = { @@ -12443,6 +17676,16 @@ def __init__( product: Optional["ProductTagResourceContractProperties"] = None, **kwargs ): + """ + :keyword tag: Required. Tag associated with the resource. + :paramtype tag: ~azure.mgmt.apimanagement.models.TagResourceContractProperties + :keyword api: API associated with the tag. + :paramtype api: ~azure.mgmt.apimanagement.models.ApiTagResourceContractProperties + :keyword operation: Operation associated with the tag. + :paramtype operation: ~azure.mgmt.apimanagement.models.OperationTagResourceContractProperties + :keyword product: Product associated with the tag. + :paramtype product: ~azure.mgmt.apimanagement.models.ProductTagResourceContractProperties + """ super(TagResourceContract, self).__init__(**kwargs) self.tag = tag self.api = api @@ -12453,10 +17696,10 @@ def __init__( class TagResourceContractProperties(msrest.serialization.Model): """Contract defining the Tag property in the Tag Resource Contract. - :param id: Tag identifier. - :type id: str - :param name: Tag Name. - :type name: str + :ivar id: Tag identifier. + :vartype id: str + :ivar name: Tag Name. + :vartype name: str """ _validation = { @@ -12475,37 +17718,61 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword id: Tag identifier. + :paramtype id: str + :keyword name: Tag Name. + :paramtype name: str + """ super(TagResourceContractProperties, self).__init__(**kwargs) self.id = id self.name = name -class TenantConfigurationSyncStateContract(msrest.serialization.Model): +class TenantConfigurationSyncStateContract(Resource): """Result of Tenant Configuration Sync State. - :param branch: The name of Git branch. - :type branch: str - :param commit_id: The latest commit Id. - :type commit_id: str - :param is_export: value indicating if last sync was save (true) or deploy (false) operation. - :type is_export: bool - :param is_synced: value indicating if last synchronization was later than the configuration + 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. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar branch: The name of Git branch. + :vartype branch: str + :ivar commit_id: The latest commit Id. + :vartype commit_id: str + :ivar is_export: value indicating if last sync was save (true) or deploy (false) operation. + :vartype is_export: bool + :ivar is_synced: value indicating if last synchronization was later than the configuration change. - :type is_synced: bool - :param is_git_enabled: value indicating whether Git configuration access is enabled. - :type is_git_enabled: bool - :param sync_date: The date of the latest synchronization. The date conforms to the following + :vartype is_synced: bool + :ivar is_git_enabled: value indicating whether Git configuration access is enabled. + :vartype is_git_enabled: bool + :ivar sync_date: The date of the latest synchronization. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type sync_date: ~datetime.datetime - :param configuration_change_date: The date of the latest configuration change. The date - conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 - standard. - :type configuration_change_date: ~datetime.datetime - :param last_operation_id: Most recent tenant configuration operation identifier. - :type last_operation_id: str + :vartype sync_date: ~datetime.datetime + :ivar configuration_change_date: The date of the latest configuration change. The date conforms + to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :vartype configuration_change_date: ~datetime.datetime + :ivar last_operation_id: Most recent tenant configuration operation identifier. + :vartype last_operation_id: 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'}, 'branch': {'key': 'properties.branch', 'type': 'str'}, 'commit_id': {'key': 'properties.commitId', 'type': 'str'}, 'is_export': {'key': 'properties.isExport', 'type': 'bool'}, @@ -12529,6 +17796,28 @@ def __init__( last_operation_id: Optional[str] = None, **kwargs ): + """ + :keyword branch: The name of Git branch. + :paramtype branch: str + :keyword commit_id: The latest commit Id. + :paramtype commit_id: str + :keyword is_export: value indicating if last sync was save (true) or deploy (false) operation. + :paramtype is_export: bool + :keyword is_synced: value indicating if last synchronization was later than the configuration + change. + :paramtype is_synced: bool + :keyword is_git_enabled: value indicating whether Git configuration access is enabled. + :paramtype is_git_enabled: bool + :keyword sync_date: The date of the latest synchronization. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype sync_date: ~datetime.datetime + :keyword configuration_change_date: The date of the latest configuration change. The date + conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype configuration_change_date: ~datetime.datetime + :keyword last_operation_id: Most recent tenant configuration operation identifier. + :paramtype last_operation_id: str + """ super(TenantConfigurationSyncStateContract, self).__init__(**kwargs) self.branch = branch self.commit_id = commit_id @@ -12565,6 +17854,8 @@ def __init__( self, **kwargs ): + """ + """ super(TenantSettingsCollection, self).__init__(**kwargs) self.value = None self.next_link = None @@ -12575,14 +17866,16 @@ class TenantSettingsContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param settings: Tenant settings. - :type settings: dict[str, str] + :ivar settings: Tenant settings. + :vartype settings: dict[str, str] """ _validation = { @@ -12604,6 +17897,10 @@ def __init__( settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword settings: Tenant settings. + :paramtype settings: dict[str, str] + """ super(TenantSettingsContract, self).__init__(**kwargs) self.settings = settings @@ -12611,12 +17908,12 @@ def __init__( class TermsOfServiceProperties(msrest.serialization.Model): """Terms of service contract properties. - :param text: A terms of service text. - :type text: str - :param enabled: Display terms of service during a sign-up process. - :type enabled: bool - :param consent_required: Ask user for consent to the terms of service. - :type consent_required: bool + :ivar text: A terms of service text. + :vartype text: str + :ivar enabled: Display terms of service during a sign-up process. + :vartype enabled: bool + :ivar consent_required: Ask user for consent to the terms of service. + :vartype consent_required: bool """ _attribute_map = { @@ -12633,6 +17930,14 @@ def __init__( consent_required: Optional[bool] = None, **kwargs ): + """ + :keyword text: A terms of service text. + :paramtype text: str + :keyword enabled: Display terms of service during a sign-up process. + :paramtype enabled: bool + :keyword consent_required: Ask user for consent to the terms of service. + :paramtype consent_required: bool + """ super(TermsOfServiceProperties, self).__init__(**kwargs) self.text = text self.enabled = enabled @@ -12644,10 +17949,10 @@ class TokenBodyParameterContract(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. body parameter name. - :type name: str - :param value: Required. body parameter value. - :type value: str + :ivar name: Required. body parameter name. + :vartype name: str + :ivar value: Required. body parameter value. + :vartype value: str """ _validation = { @@ -12667,6 +17972,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. body parameter name. + :paramtype name: str + :keyword value: Required. body parameter value. + :paramtype value: str + """ super(TokenBodyParameterContract, self).__init__(**kwargs) self.name = name self.value = value @@ -12675,12 +17986,12 @@ def __init__( class UserCollection(msrest.serialization.Model): """Paged Users list representation. - :param value: Page values. - :type value: list[~azure.mgmt.apimanagement.models.UserContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: Page values. + :vartype value: list[~azure.mgmt.apimanagement.models.UserContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -12697,6 +18008,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Page values. + :paramtype value: list[~azure.mgmt.apimanagement.models.UserContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(UserCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -12708,30 +18027,32 @@ class UserContract(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type for API Management resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param email: Email address. - :type email: str - :param registration_date: Date of user registration. The date conforms to the following format: + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar email: Email address. + :vartype email: str + :ivar registration_date: Date of user registration. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type registration_date: ~datetime.datetime + :vartype registration_date: ~datetime.datetime :ivar groups: Collection of groups user is part of. :vartype groups: list[~azure.mgmt.apimanagement.models.GroupContractProperties] """ @@ -12769,6 +18090,26 @@ def __init__( registration_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword email: Email address. + :paramtype email: str + :keyword registration_date: Date of user registration. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype registration_date: ~datetime.datetime + """ super(UserContract, self).__init__(**kwargs) self.state = state self.note = note @@ -12783,15 +18124,15 @@ def __init__( class UserEntityBaseParameters(msrest.serialization.Model): """User Entity Base Parameters set. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] """ _attribute_map = { @@ -12808,6 +18149,17 @@ def __init__( identities: Optional[List["UserIdentityContract"]] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + """ super(UserEntityBaseParameters, self).__init__(**kwargs) self.state = state self.note = note @@ -12819,24 +18171,24 @@ class UserContractProperties(UserEntityBaseParameters): Variables are only populated by the server, and will be ignored when sending a request. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param email: Email address. - :type email: str - :param registration_date: Date of user registration. The date conforms to the following format: + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar email: Email address. + :vartype email: str + :ivar registration_date: Date of user registration. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type registration_date: ~datetime.datetime + :vartype registration_date: ~datetime.datetime :ivar groups: Collection of groups user is part of. :vartype groups: list[~azure.mgmt.apimanagement.models.GroupContractProperties] """ @@ -12868,6 +18220,26 @@ def __init__( registration_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword email: Email address. + :paramtype email: str + :keyword registration_date: Date of user registration. The date conforms to the following + format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. + :paramtype registration_date: ~datetime.datetime + """ super(UserContractProperties, self).__init__(state=state, note=note, identities=identities, **kwargs) self.first_name = first_name self.last_name = last_name @@ -12881,30 +18253,30 @@ class UserCreateParameterProperties(UserEntityBaseParameters): All required parameters must be populated in order to send to Azure. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Required. Email address. Must not be empty and must be unique within the service + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Required. Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param first_name: Required. First name. - :type first_name: str - :param last_name: Required. Last name. - :type last_name: str - :param password: User Password. If no value is provided, a default password is generated. - :type password: str - :param app_type: Determines the type of application which send the create user request. Default + :vartype email: str + :ivar first_name: Required. First name. + :vartype first_name: str + :ivar last_name: Required. Last name. + :vartype last_name: str + :ivar password: User Password. If no value is provided, a default password is generated. + :vartype password: str + :ivar app_type: Determines the type of application which send the create 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 be sent to the newly + :vartype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :ivar confirmation: Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: "signup", "invite". - :type confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + :vartype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation """ _validation = { @@ -12939,6 +18311,32 @@ def __init__( confirmation: Optional[Union[str, "Confirmation"]] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Required. Email address. Must not be empty and must be unique within the + service instance. + :paramtype email: str + :keyword first_name: Required. First name. + :paramtype first_name: str + :keyword last_name: Required. Last name. + :paramtype last_name: str + :keyword password: User Password. If no value is provided, a default password is generated. + :paramtype password: str + :keyword app_type: Determines the type of application which send the create user request. + Default is legacy portal. Possible values include: "portal", "developerPortal". + :paramtype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :keyword confirmation: Determines the type of confirmation e-mail that will be sent to the + newly created user. Possible values include: "signup", "invite". + :paramtype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + """ super(UserCreateParameterProperties, self).__init__(state=state, note=note, identities=identities, **kwargs) self.email = email self.first_name = first_name @@ -12951,29 +18349,29 @@ def __init__( class UserCreateParameters(msrest.serialization.Model): """User create details. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param password: User Password. If no value is provided, a default password is generated. - :type password: str - :param app_type: Determines the type of application which send the create user request. Default + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Email address. Must not be empty and must be unique within the service instance. + :vartype email: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar password: User Password. If no value is provided, a default password is generated. + :vartype password: str + :ivar app_type: Determines the type of application which send the create 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 be sent to the newly + :vartype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :ivar confirmation: Determines the type of confirmation e-mail that will be sent to the newly created user. Possible values include: "signup", "invite". - :type confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + :vartype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation """ _validation = { @@ -13008,6 +18406,32 @@ def __init__( confirmation: Optional[Union[str, "Confirmation"]] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Email address. Must not be empty and must be unique within the service + instance. + :paramtype email: str + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword password: User Password. If no value is provided, a default password is generated. + :paramtype password: str + :keyword app_type: Determines the type of application which send the create user request. + Default is legacy portal. Possible values include: "portal", "developerPortal". + :paramtype app_type: str or ~azure.mgmt.apimanagement.models.AppType + :keyword confirmation: Determines the type of confirmation e-mail that will be sent to the + newly created user. Possible values include: "signup", "invite". + :paramtype confirmation: str or ~azure.mgmt.apimanagement.models.Confirmation + """ super(UserCreateParameters, self).__init__(**kwargs) self.state = state self.note = note @@ -13023,12 +18447,12 @@ def __init__( class UserIdentityCollection(msrest.serialization.Model): """List of Users Identity list representation. - :param value: User Identity values. - :type value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param count: Total record count number across all pages. - :type count: long - :param next_link: Next page link if any. - :type next_link: str + :ivar value: User Identity values. + :vartype value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar count: Total record count number across all pages. + :vartype count: long + :ivar next_link: Next page link if any. + :vartype next_link: str """ _attribute_map = { @@ -13045,6 +18469,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: User Identity values. + :paramtype value: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword count: Total record count number across all pages. + :paramtype count: long + :keyword next_link: Next page link if any. + :paramtype next_link: str + """ super(UserIdentityCollection, self).__init__(**kwargs) self.value = value self.count = count @@ -13054,10 +18486,10 @@ def __init__( class UserIdentityContract(msrest.serialization.Model): """User identity details. - :param provider: Identity provider name. - :type provider: str - :param id: Identifier value within provider. - :type id: str + :ivar provider: Identity provider name. + :vartype provider: str + :ivar id: Identifier value within provider. + :vartype id: str """ _attribute_map = { @@ -13072,6 +18504,12 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword provider: Identity provider name. + :paramtype provider: str + :keyword id: Identifier value within provider. + :paramtype id: str + """ super(UserIdentityContract, self).__init__(**kwargs) self.provider = provider self.id = id @@ -13080,10 +18518,10 @@ def __init__( class UserIdentityProperties(msrest.serialization.Model): """UserIdentityProperties. - :param principal_id: The principal id of user assigned identity. - :type principal_id: str - :param client_id: The client id of user assigned identity. - :type client_id: str + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _attribute_map = { @@ -13098,6 +18536,12 @@ def __init__( client_id: Optional[str] = None, **kwargs ): + """ + :keyword principal_id: The principal id of user assigned identity. + :paramtype principal_id: str + :keyword client_id: The client id of user assigned identity. + :paramtype client_id: str + """ super(UserIdentityProperties, self).__init__(**kwargs) self.principal_id = principal_id self.client_id = client_id @@ -13106,13 +18550,13 @@ def __init__( class UserTokenParameters(msrest.serialization.Model): """Get User Token parameters. - :param key_type: The Key to be used to generate token for user. Possible values include: + :ivar key_type: The Key to be used to generate token for user. Possible values include: "primary", "secondary". - :type key_type: str or ~azure.mgmt.apimanagement.models.KeyType - :param expiry: The Expiry time of the Token. Maximum token expiry time is set to 30 days. The + :vartype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :ivar expiry: The Expiry time of the Token. Maximum token expiry time is set to 30 days. The date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 standard. - :type expiry: ~datetime.datetime + :vartype expiry: ~datetime.datetime """ _attribute_map = { @@ -13127,6 +18571,15 @@ def __init__( expiry: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword key_type: The Key to be used to generate token for user. Possible values include: + "primary", "secondary". + :paramtype key_type: str or ~azure.mgmt.apimanagement.models.KeyType + :keyword expiry: The Expiry time of the Token. Maximum token expiry time is set to 30 days. The + date conforms to the following format: ``yyyy-MM-ddTHH:mm:ssZ`` as specified by the ISO 8601 + standard. + :paramtype expiry: ~datetime.datetime + """ super(UserTokenParameters, self).__init__(**kwargs) self.key_type = key_type self.expiry = expiry @@ -13135,8 +18588,8 @@ def __init__( class UserTokenResult(msrest.serialization.Model): """Get User Token response details. - :param value: Shared Access Authorization token for the User. - :type value: str + :ivar value: Shared Access Authorization token for the User. + :vartype value: str """ _attribute_map = { @@ -13149,6 +18602,10 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: Shared Access Authorization token for the User. + :paramtype value: str + """ super(UserTokenResult, self).__init__(**kwargs) self.value = value @@ -13156,23 +18613,23 @@ def __init__( class UserUpdateParameters(msrest.serialization.Model): """User update parameters. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param password: User Password. - :type password: str - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Email address. Must not be empty and must be unique within the service instance. + :vartype email: str + :ivar password: User Password. + :vartype password: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str """ _validation = { @@ -13203,6 +18660,26 @@ def __init__( last_name: Optional[str] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Email address. Must not be empty and must be unique within the service + instance. + :paramtype email: str + :keyword password: User Password. + :paramtype password: str + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + """ super(UserUpdateParameters, self).__init__(**kwargs) self.state = state self.note = note @@ -13216,23 +18693,23 @@ def __init__( class UserUpdateParametersProperties(UserEntityBaseParameters): """Parameters supplied to the Update User operation. - :param state: Account state. Specifies whether the user is active or not. Blocked users are + :ivar state: Account state. Specifies whether the user is active or not. Blocked users are unable to sign into the developer portal or call any APIs of subscribed products. Default state is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: "active". - :type state: str or ~azure.mgmt.apimanagement.models.UserState - :param note: Optional note about a user set by the administrator. - :type note: str - :param identities: Collection of user identities. - :type identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] - :param email: Email address. Must not be empty and must be unique within the service instance. - :type email: str - :param password: User Password. - :type password: str - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str + :vartype state: str or ~azure.mgmt.apimanagement.models.UserState + :ivar note: Optional note about a user set by the administrator. + :vartype note: str + :ivar identities: Collection of user identities. + :vartype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :ivar email: Email address. Must not be empty and must be unique within the service instance. + :vartype email: str + :ivar password: User Password. + :vartype password: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str """ _validation = { @@ -13263,6 +18740,26 @@ def __init__( last_name: Optional[str] = None, **kwargs ): + """ + :keyword state: Account state. Specifies whether the user is active or not. Blocked users are + unable to sign into the developer portal or call any APIs of subscribed products. Default state + is Active. Possible values include: "active", "blocked", "pending", "deleted". Default value: + "active". + :paramtype state: str or ~azure.mgmt.apimanagement.models.UserState + :keyword note: Optional note about a user set by the administrator. + :paramtype note: str + :keyword identities: Collection of user identities. + :paramtype identities: list[~azure.mgmt.apimanagement.models.UserIdentityContract] + :keyword email: Email address. Must not be empty and must be unique within the service + instance. + :paramtype email: str + :keyword password: User Password. + :paramtype password: str + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + """ super(UserUpdateParametersProperties, self).__init__(state=state, note=note, identities=identities, **kwargs) self.email = email self.password = password @@ -13279,9 +18776,9 @@ class VirtualNetworkConfiguration(msrest.serialization.Model): :vartype vnetid: str :ivar subnetname: The name of the subnet. :vartype subnetname: str - :param subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy the + :ivar subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy the API Management service in. - :type subnet_resource_id: str + :vartype subnet_resource_id: str """ _validation = { @@ -13302,6 +18799,11 @@ def __init__( subnet_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword subnet_resource_id: The full resource ID of a subnet in a virtual network to deploy + the API Management service in. + :paramtype subnet_resource_id: str + """ super(VirtualNetworkConfiguration, self).__init__(**kwargs) self.vnetid = None self.subnetname = None @@ -13311,10 +18813,10 @@ def __init__( class X509CertificateName(msrest.serialization.Model): """Properties of server X509Names. - :param name: Common Name of the Certificate. - :type name: str - :param issuer_certificate_thumbprint: Thumbprint for the Issuer of the Certificate. - :type issuer_certificate_thumbprint: str + :ivar name: Common Name of the Certificate. + :vartype name: str + :ivar issuer_certificate_thumbprint: Thumbprint for the Issuer of the Certificate. + :vartype issuer_certificate_thumbprint: str """ _attribute_map = { @@ -13329,6 +18831,12 @@ def __init__( issuer_certificate_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword name: Common Name of the Certificate. + :paramtype name: str + :keyword issuer_certificate_thumbprint: Thumbprint for the Issuer of the Certificate. + :paramtype issuer_certificate_thumbprint: str + """ super(X509CertificateName, self).__init__(**kwargs) self.name = name self.issuer_certificate_thumbprint = issuer_certificate_thumbprint 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 cd77fa38b0ba..9f8b6482fabb 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 @@ -27,6 +27,7 @@ from ._backend_operations import BackendOperations from ._cache_operations import CacheOperations from ._certificate_operations import CertificateOperations +from ._api_management_client_operations import ApiManagementClientOperationsMixin from ._content_type_operations import ContentTypeOperations from ._content_item_operations import ContentItemOperations from ._deleted_services_operations import DeletedServicesOperations @@ -50,6 +51,7 @@ from ._notification_recipient_user_operations import NotificationRecipientUserOperations from ._notification_recipient_email_operations import NotificationRecipientEmailOperations from ._open_id_connect_provider_operations import OpenIdConnectProviderOperations +from ._outbound_network_dependencies_endpoints_operations import OutboundNetworkDependenciesEndpointsOperations from ._policy_operations import PolicyOperations from ._policy_description_operations import PolicyDescriptionOperations from ._portal_revision_operations import PortalRevisionOperations @@ -57,6 +59,7 @@ from ._sign_in_settings_operations import SignInSettingsOperations from ._sign_up_settings_operations import SignUpSettingsOperations from ._delegation_settings_operations import DelegationSettingsOperations +from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations from ._product_operations import ProductOperations from ._product_api_operations import ProductApiOperations from ._product_group_operations import ProductGroupOperations @@ -66,6 +69,7 @@ from ._quota_by_period_keys_operations import QuotaByPeriodKeysOperations from ._region_operations import RegionOperations from ._reports_operations import ReportsOperations +from ._global_schema_operations import GlobalSchemaOperations from ._tenant_settings_operations import TenantSettingsOperations from ._api_management_skus_operations import ApiManagementSkusOperations from ._subscription_operations import SubscriptionOperations @@ -101,6 +105,7 @@ 'BackendOperations', 'CacheOperations', 'CertificateOperations', + 'ApiManagementClientOperationsMixin', 'ContentTypeOperations', 'ContentItemOperations', 'DeletedServicesOperations', @@ -124,6 +129,7 @@ 'NotificationRecipientUserOperations', 'NotificationRecipientEmailOperations', 'OpenIdConnectProviderOperations', + 'OutboundNetworkDependenciesEndpointsOperations', 'PolicyOperations', 'PolicyDescriptionOperations', 'PortalRevisionOperations', @@ -131,6 +137,7 @@ 'SignInSettingsOperations', 'SignUpSettingsOperations', 'DelegationSettingsOperations', + 'PrivateEndpointConnectionOperations', 'ProductOperations', 'ProductApiOperations', 'ProductGroupOperations', @@ -140,6 +147,7 @@ 'QuotaByPeriodKeysOperations', 'RegionOperations', 'ReportsOperations', + 'GlobalSchemaOperations', 'TenantSettingsOperations', 'ApiManagementSkusOperations', 'SubscriptionOperations', diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py index 5591441b5ee6..37bccfeace3d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_diagnostic_operations.py @@ -5,24 +5,296 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiDiagnosticOperations(object): """ApiDiagnosticOperations operations. @@ -45,6 +317,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -73,7 +346,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiagnosticCollection or the result of cls(response) + :return: An iterator like instance of either DiagnosticCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DiagnosticCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -82,43 +356,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiagnosticCollection', pipeline_response) + deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,17 +403,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -172,46 +446,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -242,47 +509,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -320,59 +581,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -410,53 +665,47 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -491,39 +740,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py index 44f07f174452..899c6ebc66a0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_export_operations.py @@ -5,23 +5,74 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + format = kwargs.pop('format') # type: Union[str, "_models.ExportFormat"] + export = kwargs.pop('export') # type: Union[str, "_models.ExportApi"] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + query_parameters['export'] = _SERIALIZER.query("export", export, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiExportOperations(object): """ApiExportOperations operations. @@ -44,6 +95,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -79,36 +131,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['export'] = self._serialize.query("export", export, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + format=format, + export=export, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiExportResult', pipeline_response) @@ -117,4 +159,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py index f58a3040ef06..87afacae6a7f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_attachment_operations.py @@ -5,24 +5,260 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + attachment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "attachmentId": _SERIALIZER.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + attachment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "attachmentId": _SERIALIZER.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + attachment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "attachmentId": _SERIALIZER.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + attachment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "attachmentId": _SERIALIZER.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiIssueAttachmentOperations(object): """ApiIssueAttachmentOperations operations. @@ -45,6 +281,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -78,8 +315,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IssueAttachmentCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueAttachmentCollection] + :return: An iterator like instance of either IssueAttachmentCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueAttachmentCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IssueAttachmentCollection"] @@ -87,44 +326,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IssueAttachmentCollection', pipeline_response) + deserialized = self._deserialize("IssueAttachmentCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +375,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -183,47 +423,40 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -258,48 +491,42 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueAttachmentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -341,60 +568,54 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueAttachmentContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueAttachmentContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueAttachmentContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueAttachmentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -433,40 +654,31 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'attachmentId': self._serialize.url("attachment_id", attachment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + attachment_id=attachment_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py index c6304d2026a8..e089a951b495 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_comment_operations.py @@ -5,24 +5,260 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + comment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "commentId": _SERIALIZER.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + comment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "commentId": _SERIALIZER.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + comment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "commentId": _SERIALIZER.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + comment_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "commentId": _SERIALIZER.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiIssueCommentOperations(object): """ApiIssueCommentOperations operations. @@ -45,6 +281,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -78,7 +315,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IssueCommentCollection or the result of cls(response) + :return: An iterator like instance of either IssueCommentCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IssueCommentCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -87,44 +325,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IssueCommentCollection', pipeline_response) + deserialized = self._deserialize("IssueCommentCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +374,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -182,47 +421,40 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -256,48 +488,42 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueCommentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -338,60 +564,54 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueCommentContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueCommentContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueCommentContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueCommentContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -429,40 +649,31 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'commentId': self._serialize.url("comment_id", comment_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + comment_id=comment_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py index 1f84a4a17361..0125b92fdaf3 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_issue_operations.py @@ -5,24 +5,303 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + expand_comments_attachments = kwargs.pop('expand_comments_attachments', None) # type: Optional[bool] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if expand_comments_attachments is not None: + query_parameters['expandCommentsAttachments'] = _SERIALIZER.query("expand_comments_attachments", expand_comments_attachments, 'bool') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand_comments_attachments = kwargs.pop('expand_comments_attachments', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if expand_comments_attachments is not None: + query_parameters['expandCommentsAttachments'] = _SERIALIZER.query("expand_comments_attachments", expand_comments_attachments, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiIssueOperations(object): """ApiIssueOperations operations. @@ -45,6 +324,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -87,45 +367,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if expand_comments_attachments is not None: - query_parameters['expandCommentsAttachments'] = self._serialize.query("expand_comments_attachments", expand_comments_attachments, 'bool') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + expand_comments_attachments=expand_comments_attachments, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + expand_comments_attachments=expand_comments_attachments, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IssueCollection', pipeline_response) + deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,17 +416,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -179,46 +459,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -252,49 +525,42 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if expand_comments_attachments is not None: - query_parameters['expandCommentsAttachments'] = self._serialize.query("expand_comments_attachments", expand_comments_attachments, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + expand_comments_attachments=expand_comments_attachments, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -332,59 +598,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -422,53 +682,47 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IssueUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IssueUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -503,39 +757,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py new file mode 100644 index 000000000000..6a5e3b79943d --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_client_operations.py @@ -0,0 +1,198 @@ +# 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 functools +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_perform_connectivity_check_async_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class ApiManagementClientOperationsMixin(object): + + def _perform_connectivity_check_async_initial( + self, + resource_group_name, # type: str + service_name, # type: str + connectivity_check_request_params, # type: "_models.ConnectivityCheckRequest" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ConnectivityCheckResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ConnectivityCheckResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connectivity_check_request_params, 'ConnectivityCheckRequest') + + request = build_perform_connectivity_check_async_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._perform_connectivity_check_async_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConnectivityCheckResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _perform_connectivity_check_async_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck'} # type: ignore + + + @distributed_trace + def begin_perform_connectivity_check_async( + self, + resource_group_name, # type: str + service_name, # type: str + connectivity_check_request_params, # type: "_models.ConnectivityCheckRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConnectivityCheckResponse"] + """Performs a connectivity check between the API Management service and a given destination, and + returns metrics for the connection, as well as errors encountered while trying to establish it. + + :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 connectivity_check_request_params: Connectivity Check request parameters. + :type connectivity_check_request_params: + ~azure.mgmt.apimanagement.models.ConnectivityCheckRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConnectivityCheckResponse or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ConnectivityCheckResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectivityCheckResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_connectivity_check_async_initial( + resource_group_name=resource_group_name, + service_name=service_name, + connectivity_check_request_params=connectivity_check_request_params, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConnectivityCheckResponse', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_connectivity_check_async.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/connectivityCheck'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py index 5d4b1eca9967..10fc7dbd5f1e 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_operations_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ApiManagement/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiManagementOperationsOperations(object): """ApiManagementOperationsOperations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,30 +97,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +130,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py index c2022facb7e4..0ec9fdc642ed 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_operations.py @@ -5,26 +5,476 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_restore_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_backup_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_sso_token_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_domain_ownership_identifier_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_apply_network_configuration_updates_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiManagementServiceOperations(object): """ApiManagementServiceOperations operations. @@ -60,39 +510,28 @@ def _restore_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restore_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') + + request = build_restore_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._restore_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -102,8 +541,11 @@ def _restore_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _restore_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore'} # type: ignore + + @distributed_trace def begin_restore( self, resource_group_name, # type: str @@ -125,15 +567,20 @@ def begin_restore( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -145,27 +592,21 @@ def begin_restore( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -177,6 +618,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/restore'} # type: ignore def _backup_initial( @@ -192,39 +634,28 @@ def _backup_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._backup_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_backup_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._backup_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceBackupRestoreParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -234,8 +665,11 @@ def _backup_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _backup_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup'} # type: ignore + + @distributed_trace def begin_backup( self, resource_group_name, # type: str @@ -255,15 +689,20 @@ def begin_backup( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceBackupRestoreParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -275,27 +714,21 @@ def begin_backup( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -307,6 +740,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_backup.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup'} # type: ignore def _create_or_update_initial( @@ -322,39 +756,28 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ApiManagementServiceResource') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -367,8 +790,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -388,15 +814,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -408,27 +839,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -440,6 +865,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore def _update_initial( @@ -455,39 +881,28 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiManagementServiceUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -497,8 +912,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -517,15 +935,20 @@ def begin_update( :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -537,27 +960,21 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -569,8 +986,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -594,33 +1013,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) @@ -629,8 +1038,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + def _delete_initial( self, resource_group_name, # type: str @@ -643,34 +1054,23 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 202: @@ -680,8 +1080,11 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -697,15 +1100,19 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -719,24 +1126,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -748,8 +1148,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name, # type: str @@ -761,8 +1163,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiManagementServiceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] + :return: An iterator like instance of either ApiManagementServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceListResult"] @@ -770,35 +1174,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiManagementServiceListResult', pipeline_response) + deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -811,17 +1211,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service'} # type: ignore + @distributed_trace def list( self, **kwargs # type: Any @@ -830,8 +1232,10 @@ def list( """Lists all API Management services within an Azure subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiManagementServiceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] + :return: An iterator like instance of either ApiManagementServiceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceListResult"] @@ -839,34 +1243,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiManagementServiceListResult', pipeline_response) + deserialized = self._deserialize("ApiManagementServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -879,17 +1278,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service'} # type: ignore + @distributed_trace def get_sso_token( self, resource_group_name, # type: str @@ -913,33 +1314,23 @@ def get_sso_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_sso_token.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_sso_token_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_sso_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceGetSsoTokenResult', pipeline_response) @@ -948,8 +1339,11 @@ def get_sso_token( return cls(pipeline_response, deserialized, {}) return deserialized + get_sso_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/getssotoken'} # type: ignore + + @distributed_trace def check_name_availability( self, parameters, # type: "_models.ApiManagementServiceCheckNameAvailabilityParameters" @@ -959,7 +1353,8 @@ def check_name_availability( """Checks availability and correctness of a name for an API Management service. :param parameters: Parameters supplied to the CheckNameAvailability operation. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters + :type parameters: + ~azure.mgmt.apimanagement.models.ApiManagementServiceCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApiManagementServiceNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.apimanagement.models.ApiManagementServiceNameAvailabilityResult @@ -970,36 +1365,26 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ApiManagementServiceCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiManagementServiceCheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceNameAvailabilityResult', pipeline_response) @@ -1008,8 +1393,11 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability'} # type: ignore + + @distributed_trace def get_domain_ownership_identifier( self, **kwargs # type: Any @@ -1027,31 +1415,21 @@ def get_domain_ownership_identifier( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - # Construct URL - url = self.get_domain_ownership_identifier.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_domain_ownership_identifier_request( + subscription_id=self._config.subscription_id, + template_url=self.get_domain_ownership_identifier.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApiManagementServiceGetDomainOwnershipIdentifierResult', pipeline_response) @@ -1060,8 +1438,10 @@ def get_domain_ownership_identifier( return cls(pipeline_response, deserialized, {}) return deserialized + get_domain_ownership_identifier.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier'} # type: ignore + def _apply_network_configuration_updates_initial( self, resource_group_name, # type: str @@ -1075,42 +1455,31 @@ def _apply_network_configuration_updates_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._apply_network_configuration_updates_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'ApiManagementServiceApplyNetworkConfigurationParameters') + _json = self._serialize.body(parameters, 'ApiManagementServiceApplyNetworkConfigurationParameters') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_apply_network_configuration_updates_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._apply_network_configuration_updates_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -1120,8 +1489,11 @@ def _apply_network_configuration_updates_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _apply_network_configuration_updates_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates'} # type: ignore + + @distributed_trace def begin_apply_network_configuration_updates( self, resource_group_name, # type: str @@ -1140,18 +1512,24 @@ def begin_apply_network_configuration_updates( :param parameters: Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region. - :type parameters: ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters + :type parameters: + ~azure.mgmt.apimanagement.models.ApiManagementServiceApplyNetworkConfigurationParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiManagementServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiManagementServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiManagementServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiManagementServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -1163,27 +1541,21 @@ def begin_apply_network_configuration_updates( resource_group_name=resource_group_name, service_name=service_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiManagementServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1195,4 +1567,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_apply_network_configuration_updates.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/applynetworkconfigurationupdates'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py index e10caea09754..9c2b25717e35 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_service_skus_operations.py @@ -5,24 +5,68 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_available_service_skus_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiManagementServiceSkusOperations(object): """ApiManagementServiceSkusOperations operations. @@ -45,6 +89,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_available_service_skus( self, resource_group_name, # type: str @@ -70,36 +115,33 @@ def list_available_service_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_available_service_skus.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_service_skus_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_available_service_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_available_service_skus_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuResults', pipeline_response) + deserialized = self._deserialize("ResourceSkuResults", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,12 +154,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py index 0e9f55e36f75..90dbb8c8d281 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_management_skus_operations.py @@ -5,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiManagementSkusOperations(object): """ApiManagementSkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,7 +94,8 @@ def list( """Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiManagementSkusResult or the result of cls(response) + :return: An iterator like instance of either ApiManagementSkusResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiManagementSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -62,34 +104,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiManagementSkusResult', pipeline_response) + deserialized = self._deserialize("ApiManagementSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,12 +139,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py index a462d56086b1..18fc2bf43397 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_operations.py @@ -5,24 +5,299 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + tags = kwargs.pop('tags', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if tags is not None: + query_parameters['tags'] = _SERIALIZER.query("tags", tags, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiOperationOperations(object): """ApiOperationOperations operations. @@ -45,6 +320,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name, # type: str @@ -91,45 +367,43 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationCollection', pipeline_response) + deserialized = self._deserialize("OperationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -142,17 +416,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -184,46 +460,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -255,47 +524,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -334,59 +597,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OperationContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OperationContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -425,53 +682,47 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OperationUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OperationUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OperationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -507,39 +758,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py index 9fd372823354..e49c89c8edd7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operation_policy_operations.py @@ -5,23 +5,253 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_operation_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + format = kwargs.pop('format', "xml") # type: Optional[Union[str, "_models.PolicyExportFormat"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if format is not None: + query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiOperationPolicyOperations(object): """ApiOperationPolicyOperations operations. @@ -44,6 +274,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_operation( self, resource_group_name, # type: str @@ -75,35 +306,25 @@ def list_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -112,8 +333,11 @@ def list_by_operation( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies'} # type: ignore + + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -148,47 +372,40 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -226,50 +443,43 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -311,60 +521,54 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -403,40 +607,31 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py index 570a6ea9accf..aaa0d2a4dcd0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_operations.py @@ -5,26 +5,344 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + tags = kwargs.pop('tags', None) # type: Optional[str] + expand_api_version_set = kwargs.pop('expand_api_version_set', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if tags is not None: + query_parameters['tags'] = _SERIALIZER.query("tags", tags, 'str') + if expand_api_version_set is not None: + query_parameters['expandApiVersionSet'] = _SERIALIZER.query("expand_api_version_set", expand_api_version_set, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + delete_revisions = kwargs.pop('delete_revisions', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if delete_revisions is not None: + query_parameters['deleteRevisions'] = _SERIALIZER.query("delete_revisions", delete_revisions, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_tags_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + include_not_tagged_apis = kwargs.pop('include_not_tagged_apis', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apisByTags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if include_not_tagged_apis is not None: + query_parameters['includeNotTaggedApis'] = _SERIALIZER.query("include_not_tagged_apis", include_not_tagged_apis, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiOperations(object): """ApiOperations operations. @@ -47,6 +365,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -92,46 +411,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, 'str') - if expand_api_version_set is not None: - query_parameters['expandApiVersionSet'] = self._serialize.query("expand_api_version_set", expand_api_version_set, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + expand_api_version_set=expand_api_version_set, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + tags=tags, + expand_api_version_set=expand_api_version_set, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiCollection', pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -144,17 +460,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -182,45 +500,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -248,51 +559,39 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json, application/vnd.swagger.doc+json, application/vnd.oai.openapi+json, application/vnd.sun.wadl+xml, application/wsdl+xml" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 200]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) - deserialized = self._deserialize('ApiContract', pipeline_response) + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) - if response.status_code == 200: - response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) - deserialized = self._deserialize('ApiContract', pipeline_response) + deserialized = self._deserialize('ApiContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -308,59 +607,52 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiCreateOrUpdateParameter') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiCreateOrUpdateParameter') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -387,15 +679,19 @@ def begin_create_or_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.ApiContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -409,31 +705,24 @@ def begin_create_or_update( api_id=api_id, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -445,8 +734,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + @distributed_trace def update( self, resource_group_name, # type: str @@ -481,52 +772,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -561,37 +846,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if delete_revisions is not None: - query_parameters['deleteRevisions'] = self._serialize.query("delete_revisions", delete_revisions, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + delete_revisions=delete_revisions, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -599,6 +873,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}'} # type: ignore + + @distributed_trace def list_by_tags( self, resource_group_name, # type: str @@ -633,7 +909,8 @@ def list_by_tags( :param include_not_tagged_apis: Include not tagged APIs. :type include_not_tagged_apis: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -642,44 +919,41 @@ def list_by_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_tags.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if include_not_tagged_apis is not None: - query_parameters['includeNotTaggedApis'] = self._serialize.query("include_not_tagged_apis", include_not_tagged_apis, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_apis=include_not_tagged_apis, + template_url=self.list_by_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_apis=include_not_tagged_apis, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -692,12 +966,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py index 2075471cf614..0753fce87584 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_policy_operations.py @@ -5,23 +5,243 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + format = kwargs.pop('format', "xml") # type: Optional[Union[str, "_models.PolicyExportFormat"]] + + api_version = "2021-08-01" + accept = "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if format is not None: + query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiPolicyOperations(object): """ApiPolicyOperations operations. @@ -44,6 +264,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name, # type: str @@ -71,34 +292,24 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -107,8 +318,11 @@ def list_by_api( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies'} # type: ignore + + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -139,46 +353,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -212,54 +419,48 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -297,59 +498,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -384,39 +579,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py index 4d225d92164e..d6098b56b1ea 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_product_operations.py @@ -5,24 +5,80 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_apis_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/products') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiProductOperations(object): """ApiProductOperations operations. @@ -45,6 +101,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_apis( self, resource_group_name, # type: str @@ -82,43 +139,41 @@ def list_by_apis( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_apis.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_apis_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_apis.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_apis_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProductCollection', pipeline_response) + deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,12 +186,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py index 61fce57894aa..b35e977d4e01 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_release_operations.py @@ -5,24 +5,296 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + release_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "releaseId": _SERIALIZER.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + release_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "releaseId": _SERIALIZER.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + release_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "releaseId": _SERIALIZER.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + release_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "releaseId": _SERIALIZER.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + release_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "releaseId": _SERIALIZER.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiReleaseOperations(object): """ApiReleaseOperations operations. @@ -45,6 +317,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -75,7 +348,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiReleaseCollection or the result of cls(response) + :return: An iterator like instance of either ApiReleaseCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiReleaseCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -84,43 +358,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiReleaseCollection', pipeline_response) + deserialized = self._deserialize("ApiReleaseCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +405,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -174,46 +448,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -244,47 +511,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -322,59 +583,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiReleaseContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiReleaseContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -412,53 +667,47 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiReleaseContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiReleaseContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiReleaseContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -493,39 +742,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=80, min_length=1), - 'releaseId': self._serialize.url("release_id", release_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + release_id=release_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py index 2b4d33e8fe0b..e92368a9bed7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_revision_operations.py @@ -5,24 +5,80 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/revisions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiRevisionOperations(object): """ApiRevisionOperations operations. @@ -45,6 +101,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -73,7 +130,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiRevisionCollection or the result of cls(response) + :return: An iterator like instance of either ApiRevisionCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiRevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -82,43 +140,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiRevisionCollection', pipeline_response) + deserialized = self._deserialize("ApiRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -131,12 +187,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py index 8cbe44ecace1..fecf52bb3382 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_schema_operations.py @@ -5,26 +5,255 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + force = kwargs.pop('force', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiSchemaOperations(object): """ApiSchemaOperations operations. @@ -47,6 +276,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name, # type: str @@ -85,43 +315,41 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SchemaCollection', pipeline_response) + deserialized = self._deserialize("SchemaCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -134,17 +362,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -163,8 +393,8 @@ def get_entity_tag( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: bool, or the result of cls(response) @@ -176,46 +406,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -234,8 +457,8 @@ def get( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SchemaContract, or the result of cls(response) @@ -247,47 +470,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -304,60 +520,53 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SchemaContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SchemaContract') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -378,8 +587,8 @@ def begin_create_or_update( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :param parameters: The schema contents to apply. :type parameters: ~azure.mgmt.apimanagement.models.SchemaContract @@ -388,15 +597,19 @@ def begin_create_or_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SchemaContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SchemaContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.SchemaContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SchemaContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -411,32 +624,24 @@ def begin_create_or_update( schema_id=schema_id, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SchemaContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -448,8 +653,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + @distributed_trace def delete( self, resource_group_name, # type: str @@ -470,8 +677,8 @@ def delete( :param api_id: API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. :type api_id: str - :param schema_id: Schema identifier within an API. Must be unique in the current API Management - service instance. + :param schema_id: Schema id identifier. Must be unique in the current API Management service + instance. :type schema_id: str :param if_match: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update. @@ -488,41 +695,31 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'schemaId': self._serialize.url("schema_id", schema_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py index eb2003ce33ca..38648e2223ea 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_tag_description_operations.py @@ -5,24 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_description_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagDescriptionId": _SERIALIZER.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_description_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagDescriptionId": _SERIALIZER.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_description_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagDescriptionId": _SERIALIZER.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_description_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagDescriptionId": _SERIALIZER.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiTagDescriptionOperations(object): """ApiTagDescriptionOperations operations. @@ -45,6 +271,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -76,7 +303,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagDescriptionCollection or the result of cls(response) + :return: An iterator like instance of either TagDescriptionCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagDescriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -85,43 +313,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagDescriptionCollection', pipeline_response) + deserialized = self._deserialize("TagDescriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -134,17 +360,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -176,46 +404,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -247,47 +468,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagDescriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -326,59 +541,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagDescriptionCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagDescriptionCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagDescriptionContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagDescriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -414,39 +623,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagDescriptionId': self._serialize.url("tag_description_id", tag_description_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_description_id=tag_description_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py index 62e8345b13b2..6a4eca9d9e3d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_api_version_set_operations.py @@ -5,24 +5,284 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + version_set_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "versionSetId": _SERIALIZER.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + version_set_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "versionSetId": _SERIALIZER.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + version_set_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "versionSetId": _SERIALIZER.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + version_set_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "versionSetId": _SERIALIZER.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + version_set_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "versionSetId": _SERIALIZER.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ApiVersionSetOperations(object): """ApiVersionSetOperations operations. @@ -45,6 +305,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -69,7 +330,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiVersionSetCollection or the result of cls(response) + :return: An iterator like instance of either ApiVersionSetCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ApiVersionSetCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -78,42 +340,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiVersionSetCollection', pipeline_response) + deserialized = self._deserialize("ApiVersionSetCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,17 +385,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -164,45 +425,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -230,46 +484,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -304,58 +552,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiVersionSetContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiVersionSetContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -390,52 +632,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApiVersionSetUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApiVersionSetUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ApiVersionSetContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -467,38 +703,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'versionSetId': self._serialize.url("version_set_id", version_set_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + version_set_id=version_set_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py index 05ed2efd3908..b4e654c22895 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_authorization_server_operations.py @@ -5,24 +5,322 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + authsid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "authsid": _SERIALIZER.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + authsid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "authsid": _SERIALIZER.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + authsid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "authsid": _SERIALIZER.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + authsid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "authsid": _SERIALIZER.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + authsid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "authsid": _SERIALIZER.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + resource_group_name, # type: str + service_name, # type: str + authsid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "authsid": _SERIALIZER.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class AuthorizationServerOperations(object): """AuthorizationServerOperations operations. @@ -45,6 +343,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -72,8 +371,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AuthorizationServerCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AuthorizationServerCollection] + :return: An iterator like instance of either AuthorizationServerCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AuthorizationServerCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthorizationServerCollection"] @@ -81,42 +382,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AuthorizationServerCollection', pipeline_response) + deserialized = self._deserialize("AuthorizationServerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,17 +427,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -166,45 +466,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -231,46 +524,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -304,58 +591,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AuthorizationServerContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AuthorizationServerContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -389,52 +670,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AuthorizationServerUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AuthorizationServerUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -465,35 +740,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -501,6 +766,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'} # type: ignore + + @distributed_trace def list_secrets( self, resource_group_name, # type: str @@ -527,42 +794,35 @@ def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'authsid': self._serialize.url("authsid", authsid, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + authsid=authsid, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AuthorizationServerSecretsContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py index 0188edb8ff6a..d257680d5d94 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_backend_operations.py @@ -5,24 +5,326 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + backend_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "backendId": _SERIALIZER.url("backend_id", backend_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + backend_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "backendId": _SERIALIZER.url("backend_id", backend_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + backend_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "backendId": _SERIALIZER.url("backend_id", backend_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + backend_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "backendId": _SERIALIZER.url("backend_id", backend_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + backend_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "backendId": _SERIALIZER.url("backend_id", backend_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_reconnect_request( + resource_group_name, # type: str + service_name, # type: str + backend_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "backendId": _SERIALIZER.url("backend_id", backend_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class BackendOperations(object): """BackendOperations operations. @@ -45,6 +347,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -81,42 +384,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BackendCollection', pipeline_response) + deserialized = self._deserialize("BackendCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,17 +429,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -167,45 +469,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -233,46 +528,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -307,58 +596,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackendContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackendContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -393,52 +676,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BackendUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'BackendUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('BackendContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -470,35 +747,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -506,6 +773,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}'} # type: ignore + + @distributed_trace def reconnect( self, resource_group_name, # type: str @@ -537,45 +806,36 @@ def reconnect( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.reconnect.metadata['url'] # type: ignore - 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])?$'), - 'backendId': self._serialize.url("backend_id", backend_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'BackendReconnectContract') + _json = self._serialize.body(parameters, 'BackendReconnectContract') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_reconnect_request( + resource_group_name=resource_group_name, + service_name=service_name, + backend_id=backend_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.reconnect.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) reconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}/reconnect'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py index 48edb1056587..22b4cd76d9cb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_cache_operations.py @@ -5,24 +5,281 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + cache_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "cacheId": _SERIALIZER.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + cache_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "cacheId": _SERIALIZER.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + cache_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "cacheId": _SERIALIZER.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + cache_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "cacheId": _SERIALIZER.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + cache_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "cacheId": _SERIALIZER.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CacheOperations(object): """CacheOperations operations. @@ -45,6 +302,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -74,40 +332,37 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CacheCollection', pipeline_response) + deserialized = self._deserialize("CacheCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,17 +375,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -158,45 +415,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -224,46 +474,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -298,58 +542,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CacheContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CacheContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -384,52 +622,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CacheUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CacheUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CacheContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -461,38 +693,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'cacheId': self._serialize.url("cache_id", cache_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + cache_id=cache_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py index 328ada399671..ecb52f94011f 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_certificate_operations.py @@ -5,24 +5,281 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + is_key_vault_refresh_failed = kwargs.pop('is_key_vault_refresh_failed', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if is_key_vault_refresh_failed is not None: + query_parameters['isKeyVaultRefreshFailed'] = _SERIALIZER.query("is_key_vault_refresh_failed", is_key_vault_refresh_failed, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_secret_request( + resource_group_name, # type: str + service_name, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CertificateOperations(object): """CertificateOperations operations. @@ -45,6 +302,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -77,7 +335,8 @@ def list_by_service( entities which failed refresh. :type is_key_vault_refresh_failed: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateCollection or the result of cls(response) + :return: An iterator like instance of either CertificateCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.CertificateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -86,44 +345,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if is_key_vault_refresh_failed is not None: - query_parameters['isKeyVaultRefreshFailed'] = self._serialize.query("is_key_vault_refresh_failed", is_key_vault_refresh_failed, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateCollection', pipeline_response) + deserialized = self._deserialize("CertificateCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -136,17 +392,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -174,45 +432,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -240,46 +491,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -314,58 +559,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -397,35 +636,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -433,6 +662,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}'} # type: ignore + + @distributed_trace def refresh_secret( self, resource_group_name, # type: str @@ -460,42 +691,35 @@ def refresh_secret( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.refresh_secret.metadata['url'] # type: ignore - 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])?$'), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_secret_request( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.refresh_secret.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CertificateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + refresh_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}/refreshSecret'} # type: ignore + 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 index 834ab75e14c3..02043f5075f8 100644 --- 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 @@ -5,24 +5,237 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + content_item_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + content_item_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + content_item_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + content_item_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "contentItemId": _SERIALIZER.url("content_item_id", content_item_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ContentItemOperations(object): """ContentItemOperations operations. @@ -45,6 +258,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -62,7 +276,8 @@ def list_by_service( :param content_type_id: Content type identifier. :type content_type_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContentItemCollection or the result of cls(response) + :return: An iterator like instance of either ContentItemCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ContentItemCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,37 +286,35 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContentItemCollection', pipeline_response) + deserialized = self._deserialize("ContentItemCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +327,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -155,46 +370,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -224,47 +432,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentItemContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -298,54 +500,48 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentItemContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentItemContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -379,39 +575,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + content_item_id=content_item_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}'} # type: ignore + 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 index 0432ae10d060..7e54863c03db 100644 --- 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 @@ -5,24 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + content_type_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("content_type_id", content_type_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ContentTypeOperations(object): """ContentTypeOperations operations. @@ -45,6 +210,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -60,7 +226,8 @@ def list_by_service( :param service_name: The name of the API Management service. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ContentTypeCollection or the result of cls(response) + :return: An iterator like instance of either ContentTypeCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.ContentTypeCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -69,36 +236,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ContentTypeCollection', pipeline_response) + deserialized = self._deserialize("ContentTypeCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +275,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -149,46 +315,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentTypeContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -221,53 +381,47 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentTypeContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ContentTypeContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -300,38 +454,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + content_type_id=content_type_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py index e26b0d3b0bc3..98bb47672a86 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_delegation_settings_operations.py @@ -5,23 +5,224 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DelegationSettingsOperations(object): """DelegationSettingsOperations operations. @@ -44,6 +245,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -67,44 +269,37 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -128,45 +323,39 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalDelegationSettings', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -197,39 +386,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalDelegationSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalDelegationSettings') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -237,6 +416,8 @@ def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -267,40 +448,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalDelegationSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalDelegationSettings') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalDelegationSettings', pipeline_response) @@ -309,8 +479,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation'} # type: ignore + + @distributed_trace def list_secrets( self, resource_group_name, # type: str @@ -334,33 +507,23 @@ def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSettingValidationKeyContract', pipeline_response) @@ -369,4 +532,6 @@ def list_secrets( return cls(pipeline_response, deserialized, {}) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py index 1aa702e0791e..6af770967008 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_deleted_services_operations.py @@ -5,26 +5,138 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_name_request( + service_name, # type: str + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}') + path_format_arguments = { + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_request_initial( + service_name, # type: str + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}') + path_format_arguments = { + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DeletedServicesOperations(object): """DeletedServicesOperations operations. @@ -47,6 +159,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs # type: Any @@ -55,8 +168,10 @@ def list_by_subscription( """Lists all soft-deleted services available for undelete for the given subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedServicesCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DeletedServicesCollection] + :return: An iterator like instance of either DeletedServicesCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DeletedServicesCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedServicesCollection"] @@ -64,34 +179,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedServicesCollection', pipeline_response) + deserialized = self._deserialize("DeletedServicesCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,17 +214,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices'} # type: ignore + @distributed_trace def get_by_name( self, service_name, # type: str @@ -138,33 +250,23 @@ def get_by_name( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_name.metadata['url'] # type: ignore - path_format_arguments = { - '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'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_name_request( + service_name=service_name, + subscription_id=self._config.subscription_id, + location=location, + template_url=self.get_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedServiceContract', pipeline_response) @@ -173,8 +275,10 @@ def get_by_name( return cls(pipeline_response, deserialized, {}) return deserialized + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}'} # type: ignore + def _purge_initial( self, service_name, # type: str @@ -187,34 +291,23 @@ def _purge_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._purge_initial.metadata['url'] # type: ignore - path_format_arguments = { - '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'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_request_initial( + service_name=service_name, + subscription_id=self._config.subscription_id, + location=location, + template_url=self._purge_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 202: @@ -224,8 +317,11 @@ def _purge_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}'} # type: ignore + + @distributed_trace def begin_purge( self, service_name, # type: str @@ -241,15 +337,18 @@ def begin_purge( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeletedServiceContract or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.DeletedServiceContract] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedServiceContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,24 +362,17 @@ def begin_purge( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeletedServiceContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - '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'), - 'location': self._serialize.url("location", location, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -292,4 +384,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py index 07a10ac114d9..d2ca4bfb3572 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_diagnostic_operations.py @@ -5,24 +5,284 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + diagnostic_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "diagnosticId": _SERIALIZER.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DiagnosticOperations(object): """DiagnosticOperations operations. @@ -45,6 +305,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -70,7 +331,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DiagnosticCollection or the result of cls(response) + :return: An iterator like instance of either DiagnosticCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.DiagnosticCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -79,42 +341,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DiagnosticCollection', pipeline_response) + deserialized = self._deserialize("DiagnosticCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,17 +386,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -165,45 +426,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -231,46 +485,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -305,58 +553,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -391,52 +633,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DiagnosticContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DiagnosticContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('DiagnosticContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -468,38 +704,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'diagnosticId': self._serialize.url("diagnostic_id", diagnostic_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + diagnostic_id=diagnostic_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py index 72c2d4d59c28..a808639b8e5a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_email_template_operations.py @@ -5,24 +5,284 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + template_name, # type: Union[str, "_models.TemplateName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "templateName": _SERIALIZER.url("template_name", template_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + template_name, # type: Union[str, "_models.TemplateName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "templateName": _SERIALIZER.url("template_name", template_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + template_name, # type: Union[str, "_models.TemplateName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "templateName": _SERIALIZER.url("template_name", template_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + template_name, # type: Union[str, "_models.TemplateName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "templateName": _SERIALIZER.url("template_name", template_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + template_name, # type: Union[str, "_models.TemplateName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "templateName": _SERIALIZER.url("template_name", template_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class EmailTemplateOperations(object): """EmailTemplateOperations operations. @@ -45,6 +305,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -70,7 +331,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EmailTemplateCollection or the result of cls(response) + :return: An iterator like instance of either EmailTemplateCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.EmailTemplateCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -79,42 +341,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EmailTemplateCollection', pipeline_response) + deserialized = self._deserialize("EmailTemplateCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,17 +386,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -164,45 +425,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -229,46 +483,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('EmailTemplateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -302,41 +550,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -349,8 +586,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -384,52 +624,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'EmailTemplateUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('EmailTemplateContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -460,38 +694,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'templateName': self._serialize.url("template_name", template_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + template_name=template_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py index 33f740d3b773..eedc9a42b290 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_api_operations.py @@ -5,24 +5,204 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class GatewayApiOperations(object): """GatewayApiOperations operations. @@ -45,6 +225,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -83,43 +264,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiCollection', pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +311,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -173,46 +354,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -246,43 +420,33 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if parameters is not None: - body_content = self._serialize.body(parameters, 'AssociationContract') + _json = self._serialize.body(parameters, 'AssociationContract') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -295,8 +459,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -327,38 +494,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'apiId': self._serialize.url("api_id", api_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py index f249941ab9b7..66e47a0a06c0 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_certificate_authority_operations.py @@ -5,24 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + certificate_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "certificateId": _SERIALIZER.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class GatewayCertificateAuthorityOperations(object): """GatewayCertificateAuthorityOperations operations. @@ -45,6 +271,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -74,8 +301,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCertificateAuthorityCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityCollection] + :return: An iterator like instance of either GatewayCertificateAuthorityCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GatewayCertificateAuthorityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCertificateAuthorityCollection"] @@ -83,43 +312,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayCertificateAuthorityCollection', pipeline_response) + deserialized = self._deserialize("GatewayCertificateAuthorityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +359,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -174,46 +403,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -245,47 +467,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayCertificateAuthorityContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -324,59 +540,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayCertificateAuthorityContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayCertificateAuthorityContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayCertificateAuthorityContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayCertificateAuthorityContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -412,39 +622,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'certificateId': self._serialize.url("certificate_id", certificate_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + certificate_id=certificate_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py index 18430a5b9d74..5fe37df160c7 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_hostname_configuration_operations.py @@ -5,24 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + hc_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "hcId": _SERIALIZER.url("hc_id", hc_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + hc_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "hcId": _SERIALIZER.url("hc_id", hc_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + hc_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "hcId": _SERIALIZER.url("hc_id", hc_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + hc_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "hcId": _SERIALIZER.url("hc_id", hc_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class GatewayHostnameConfigurationOperations(object): """GatewayHostnameConfigurationOperations operations. @@ -45,6 +271,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -75,8 +302,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayHostnameConfigurationCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationCollection] + :return: An iterator like instance of either GatewayHostnameConfigurationCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GatewayHostnameConfigurationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayHostnameConfigurationCollection"] @@ -84,43 +313,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayHostnameConfigurationCollection', pipeline_response) + deserialized = self._deserialize("GatewayHostnameConfigurationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +360,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -176,46 +405,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -247,47 +469,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayHostnameConfigurationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -326,59 +542,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayHostnameConfigurationContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayHostnameConfigurationContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayHostnameConfigurationContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayHostnameConfigurationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -414,39 +624,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), - 'hcId': self._serialize.url("hc_id", hc_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + hc_id=hc_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py index 0514066a16e7..b6d3ed8cea38 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_gateway_operations.py @@ -5,24 +5,406 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_keys_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_key_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_token_request( + resource_group_name, # type: str + service_name, # type: str + gateway_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "gatewayId": _SERIALIZER.url("gateway_id", gateway_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class GatewayOperations(object): """GatewayOperations operations. @@ -45,6 +427,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -82,42 +465,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayCollection', pipeline_response) + deserialized = self._deserialize("GatewayCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,17 +510,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -168,45 +550,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -234,46 +609,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -308,58 +677,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -394,52 +757,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -471,35 +828,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -507,6 +854,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}'} # type: ignore + + @distributed_trace def list_keys( self, resource_group_name, # type: str @@ -534,46 +883,40 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_keys_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + template_url=self.list_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GatewayKeysContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/listKeys'} # type: ignore + + @distributed_trace def regenerate_key( self, resource_group_name, # type: str @@ -604,39 +947,29 @@ def regenerate_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_key.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayKeyRegenerationRequestContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.regenerate_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayKeyRegenerationRequestContract') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -644,6 +977,8 @@ def regenerate_key( regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/regenerateKey'} # type: ignore + + @distributed_trace def generate_token( self, resource_group_name, # type: str @@ -674,39 +1009,29 @@ def generate_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.generate_token.metadata['url'] # type: ignore - 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])?$'), - 'gatewayId': self._serialize.url("gateway_id", gateway_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GatewayTokenRequestContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_generate_token_request( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_id=gateway_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.generate_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GatewayTokenRequestContract') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GatewayTokenContract', pipeline_response) @@ -715,4 +1040,6 @@ def generate_token( return cls(pipeline_response, deserialized, {}) return deserialized + generate_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/generateToken'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py new file mode 100644 index 000000000000..fe09b6341bfe --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_global_schema_operations.py @@ -0,0 +1,681 @@ +# 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 functools +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "schemaId": _SERIALIZER.url("schema_id", schema_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class GlobalSchemaOperations(object): + """GlobalSchemaOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.apimanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_service( + self, + resource_group_name, # type: str + service_name, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GlobalSchemaCollection"] + """Lists a collection of schemas registered with service instance. + + :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 filter: | Field | Usage | Supported operators | Supported + functions |
|-------------|-------------|-------------|-------------|
| name | + filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |
. + :type filter: str + :param top: Number of records to return. + :type top: int + :param skip: Number of records to skip. + :type skip: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GlobalSchemaCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.GlobalSchemaCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalSchemaCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GlobalSchemaCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas'} # type: ignore + + @distributed_trace + def get_entity_tag( + self, + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> bool + """Gets the entity state (Etag) version of the Schema specified by its identifier. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + + if cls: + return cls(pipeline_response, None, response_headers) + return 200 <= response.status_code <= 299 + + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GlobalSchemaContract" + """Gets the details of the Schema specified by its identifier. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GlobalSchemaContract, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.GlobalSchemaContract + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalSchemaContract"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + parameters, # type: "_models.GlobalSchemaContract" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.GlobalSchemaContract"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.GlobalSchemaContract"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GlobalSchemaContract') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + + if response.status_code == 201: + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + parameters, # type: "_models.GlobalSchemaContract" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GlobalSchemaContract"] + """Creates new or updates existing specified Schema of the API Management service instance. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :param parameters: Create or update parameters. + :type parameters: ~azure.mgmt.apimanagement.models.GlobalSchemaContract + :param if_match: ETag of the Entity. Not required when creating an entity, but required when + updating an entity. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GlobalSchemaContract or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.GlobalSchemaContract] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GlobalSchemaContract"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + parameters=parameters, + if_match=if_match, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + + deserialized = self._deserialize('GlobalSchemaContract', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name, # type: str + service_name, # type: str + schema_id, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes specific Schema. + + :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 schema_id: Schema id identifier. Must be unique in the current API Management service + instance. + :type schema_id: str + :param if_match: ETag of the Entity. ETag should match the current entity state from the header + response of the GET request or it should be * for unconditional update. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + schema_id=schema_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py index 37476af9d0b8..7035dc98a9ce 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_operations.py @@ -5,24 +5,284 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class GroupOperations(object): """GroupOperations operations. @@ -45,6 +305,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -82,42 +343,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GroupCollection', pipeline_response) + deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,17 +388,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -168,45 +428,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -234,46 +487,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -308,58 +555,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GroupCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GroupCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -394,52 +635,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GroupUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GroupUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('GroupContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -471,38 +706,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py index 0a632ff2667c..f750efee1a04 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_group_user_operations.py @@ -5,24 +5,200 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_entity_exists_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + group_id, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class GroupUserOperations(object): """GroupUserOperations operations. @@ -45,6 +221,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -88,43 +265,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserCollection', pipeline_response) + deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +312,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users'} # type: ignore + @distributed_trace def check_entity_exists( self, resource_group_name, # type: str @@ -178,43 +355,35 @@ def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, min_length=1), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}'} # type: ignore + + @distributed_trace def create( self, resource_group_name, # type: str @@ -245,35 +414,25 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, min_length=1), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -286,8 +445,11 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -318,38 +480,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, min_length=1), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + group_id=group_id, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py index 5ce3a2a10304..3798c74522c5 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_identity_provider_operations.py @@ -5,24 +5,312 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + identity_provider_name, # type: Union[str, "_models.IdentityProviderType"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + identity_provider_name, # type: Union[str, "_models.IdentityProviderType"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + identity_provider_name, # type: Union[str, "_models.IdentityProviderType"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + identity_provider_name, # type: Union[str, "_models.IdentityProviderType"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + identity_provider_name, # type: Union[str, "_models.IdentityProviderType"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + resource_group_name, # type: str + service_name, # type: str + identity_provider_name, # type: Union[str, "_models.IdentityProviderType"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "identityProviderName": _SERIALIZER.url("identity_provider_name", identity_provider_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class IdentityProviderOperations(object): """IdentityProviderOperations operations. @@ -45,6 +333,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -59,7 +348,8 @@ def list_by_service( :param service_name: The name of the API Management service. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IdentityProviderList or the result of cls(response) + :return: An iterator like instance of either IdentityProviderList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.IdentityProviderList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -68,36 +358,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IdentityProviderList', pipeline_response) + deserialized = self._deserialize("IdentityProviderList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +397,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -147,45 +436,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -213,46 +495,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -286,58 +562,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IdentityProviderCreateContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IdentityProviderCreateContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -371,52 +641,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'IdentityProviderUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'IdentityProviderUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IdentityProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -447,35 +711,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -483,6 +737,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}'} # type: ignore + + @distributed_trace def list_secrets( self, resource_group_name, # type: str @@ -509,42 +765,35 @@ def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'identityProviderName': self._serialize.url("identity_provider_name", identity_provider_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + identity_provider_name=identity_provider_name, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ClientSecretContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py index fa3b7907de74..d968fe951d5a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_issue_operations.py @@ -5,24 +5,116 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + issue_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "issueId": _SERIALIZER.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class IssueOperations(object): """IssueOperations operations. @@ -45,6 +137,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -84,42 +177,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IssueCollection', pipeline_response) + deserialized = self._deserialize("IssueCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -132,17 +222,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -170,42 +262,35 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'issueId': self._serialize.url("issue_id", issue_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + issue_id=issue_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('IssueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py index bcd93ad4e2b9..deb6ebf40815 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_logger_operations.py @@ -5,24 +5,284 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + logger_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "loggerId": _SERIALIZER.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + logger_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "loggerId": _SERIALIZER.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + logger_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "loggerId": _SERIALIZER.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + logger_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "loggerId": _SERIALIZER.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + logger_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "loggerId": _SERIALIZER.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class LoggerOperations(object): """LoggerOperations operations. @@ -45,6 +305,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -82,42 +343,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LoggerCollection', pipeline_response) + deserialized = self._deserialize("LoggerCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,17 +388,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -167,45 +427,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -232,46 +485,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -305,58 +552,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LoggerContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LoggerContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -390,52 +631,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LoggerUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'LoggerUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('LoggerContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -466,38 +701,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'loggerId': self._serialize.url("logger_id", logger_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + logger_id=logger_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py index 6b9da0738e42..4cba1f60ecfc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_named_value_operations.py @@ -5,26 +5,365 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + is_key_vault_refresh_failed = kwargs.pop('is_key_vault_refresh_failed', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if is_key_vault_refresh_failed is not None: + query_parameters['isKeyVaultRefreshFailed'] = _SERIALIZER.query("is_key_vault_refresh_failed", is_key_vault_refresh_failed, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_value_request( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_refresh_secret_request_initial( + resource_group_name, # type: str + service_name, # type: str + named_value_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "namedValueId": _SERIALIZER.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NamedValueOperations(object): """NamedValueOperations operations. @@ -47,6 +386,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -78,7 +418,8 @@ def list_by_service( entities which failed refresh. :type is_key_vault_refresh_failed: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NamedValueCollection or the result of cls(response) + :return: An iterator like instance of either NamedValueCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.NamedValueCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -87,44 +428,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if is_key_vault_refresh_failed is not None: - query_parameters['isKeyVaultRefreshFailed'] = self._serialize.query("is_key_vault_refresh_failed", is_key_vault_refresh_failed, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + is_key_vault_refresh_failed=is_key_vault_refresh_failed, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NamedValueCollection', pipeline_response) + deserialized = self._deserialize("NamedValueCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +475,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -174,45 +514,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -239,46 +572,39 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -294,59 +620,52 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamedValueCreateContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NamedValueCreateContract') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -372,15 +691,19 @@ def begin_create_or_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NamedValueContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -394,31 +717,24 @@ def begin_create_or_update( named_value_id=named_value_id, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -430,6 +746,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore def _update_initial( @@ -447,54 +764,47 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NamedValueUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NamedValueUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -520,15 +830,19 @@ def begin_update( :type parameters: ~azure.mgmt.apimanagement.models.NamedValueUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NamedValueContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -542,31 +856,24 @@ def begin_update( named_value_id=named_value_id, if_match=if_match, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -578,8 +885,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + @distributed_trace def delete( self, resource_group_name, # type: str @@ -610,35 +919,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -646,6 +945,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}'} # type: ignore + + @distributed_trace def list_value( self, resource_group_name, # type: str @@ -672,46 +973,39 @@ def list_value( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_value.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_value_request( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self.list_value.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueSecretContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_value.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/listValue'} # type: ignore + def _refresh_secret_initial( self, resource_group_name, # type: str @@ -725,48 +1019,41 @@ def _refresh_secret_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self._refresh_secret_initial.metadata['url'] # type: ignore - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_secret_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + named_value_id=named_value_id, + subscription_id=self._config.subscription_id, + template_url=self._refresh_secret_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _refresh_secret_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret'} # type: ignore + + @distributed_trace def begin_refresh_secret( self, resource_group_name, # type: str @@ -785,15 +1072,18 @@ def begin_refresh_secret( :type named_value_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NamedValueContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NamedValueContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.NamedValueContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NamedValueContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -808,28 +1098,20 @@ def begin_refresh_secret( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('NamedValueContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'namedValueId': self._serialize.url("named_value_id", named_value_id, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -841,4 +1123,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh_secret.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}/refreshSecret'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py index fb1de731f5d6..9c60f342bc6a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_network_status_operations.py @@ -5,23 +5,105 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_location_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + location_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "locationName": _SERIALIZER.url("location_name", location_name, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NetworkStatusOperations(object): """NetworkStatusOperations operations. @@ -44,6 +126,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -69,33 +152,23 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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])?$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[NetworkStatusContractByLocation]', pipeline_response) @@ -104,8 +177,11 @@ def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/networkstatus'} # type: ignore + + @distributed_trace def list_by_location( self, resource_group_name, # type: str @@ -135,34 +211,24 @@ def list_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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])?$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_location_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + location_name=location_name, + template_url=self.list_by_location.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NetworkStatusContract', pipeline_response) @@ -171,4 +237,6 @@ def list_by_location( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/locations/{locationName}/networkstatus'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py index 0670a253a1ca..97ea69f7d063 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_operations.py @@ -5,24 +5,155 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NotificationOperations(object): """NotificationOperations operations. @@ -45,6 +176,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -65,7 +197,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either NotificationCollection or the result of cls(response) + :return: An iterator like instance of either NotificationCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.NotificationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -74,40 +207,37 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NotificationCollection', pipeline_response) + deserialized = self._deserialize("NotificationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,17 +250,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -157,34 +289,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotificationContract', pipeline_response) @@ -193,8 +315,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -225,36 +350,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NotificationContract', pipeline_response) @@ -263,4 +377,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py index 931b6c8c565d..904a25ad53f8 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_email_operations.py @@ -5,23 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_notification_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_entity_exists_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + email, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "email": _SERIALIZER.url("email", email, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + email, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "email": _SERIALIZER.url("email", email, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + email, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "email": _SERIALIZER.url("email", email, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NotificationRecipientEmailOperations(object): """NotificationRecipientEmailOperations operations. @@ -44,6 +210,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_notification( self, resource_group_name, # type: str @@ -70,34 +237,24 @@ def list_by_notification( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_notification.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_notification_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_notification.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RecipientEmailCollection', pipeline_response) @@ -106,8 +263,11 @@ def list_by_notification( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_notification.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails'} # type: ignore + + @distributed_trace def check_entity_exists( self, resource_group_name, # type: str @@ -137,43 +297,35 @@ def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'email': self._serialize.url("email", email, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + email=email, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -203,35 +355,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'email': self._serialize.url("email", email, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + email=email, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -244,8 +386,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -275,38 +420,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'email': self._serialize.url("email", email, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + email=email, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientEmails/{email}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py index 3208e12b63c3..bd09021d4940 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_notification_recipient_user_operations.py @@ -5,23 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_notification_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_entity_exists_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + notification_name, # type: Union[str, "_models.NotificationName"] + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "notificationName": _SERIALIZER.url("notification_name", notification_name, 'str'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class NotificationRecipientUserOperations(object): """NotificationRecipientUserOperations operations. @@ -44,6 +210,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_notification( self, resource_group_name, # type: str @@ -70,34 +237,24 @@ def list_by_notification( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_notification.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_notification_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_notification.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RecipientUserCollection', pipeline_response) @@ -106,8 +263,11 @@ def list_by_notification( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_notification.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers'} # type: ignore + + @distributed_trace def check_entity_exists( self, resource_group_name, # type: str @@ -137,43 +297,35 @@ def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -203,35 +355,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -244,8 +386,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -275,38 +420,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'notificationName': self._serialize.url("notification_name", notification_name, 'str'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + notification_name=notification_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}/recipientUsers/{userId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py index e009f6156a03..a55a585f8865 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_open_id_connect_provider_operations.py @@ -5,24 +5,322 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + opid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "opid": _SERIALIZER.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + opid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "opid": _SERIALIZER.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + opid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "opid": _SERIALIZER.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + opid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "opid": _SERIALIZER.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + opid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "opid": _SERIALIZER.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + resource_group_name, # type: str + service_name, # type: str + opid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "opid": _SERIALIZER.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class OpenIdConnectProviderOperations(object): """OpenIdConnectProviderOperations operations. @@ -45,6 +343,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -72,8 +371,10 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OpenIdConnectProviderCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.OpenIdConnectProviderCollection] + :return: An iterator like instance of either OpenIdConnectProviderCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.OpenIdConnectProviderCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenIdConnectProviderCollection"] @@ -81,42 +382,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OpenIdConnectProviderCollection', pipeline_response) + deserialized = self._deserialize("OpenIdConnectProviderCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,17 +427,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -166,45 +466,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -231,46 +524,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -304,58 +591,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OpenidConnectProviderContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OpenidConnectProviderContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -389,52 +670,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'OpenidConnectProviderUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OpenidConnectProviderUpdateContract') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('OpenidConnectProviderContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -465,35 +740,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -501,6 +766,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}'} # type: ignore + + @distributed_trace def list_secrets( self, resource_group_name, # type: str @@ -527,42 +794,35 @@ def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'opid': self._serialize.url("opid", opid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + opid=opid, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ClientSecretContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{opid}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py index b8405bb50ad5..7bfe06f0ffcb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_operation_operations.py @@ -5,24 +5,83 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_tags_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + include_not_tagged_operations = kwargs.pop('include_not_tagged_operations', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operationsByTags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if include_not_tagged_operations is not None: + query_parameters['includeNotTaggedOperations'] = _SERIALIZER.query("include_not_tagged_operations", include_not_tagged_operations, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class OperationOperations(object): """OperationOperations operations. @@ -45,6 +104,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_tags( self, resource_group_name, # type: str @@ -83,7 +143,8 @@ def list_by_tags( :param include_not_tagged_operations: Include not tagged Operations. :type include_not_tagged_operations: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -92,45 +153,43 @@ def list_by_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_tags.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if include_not_tagged_operations is not None: - query_parameters['includeNotTaggedOperations'] = self._serialize.query("include_not_tagged_operations", include_not_tagged_operations, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_operations=include_not_tagged_operations, + template_url=self.list_by_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_operations=include_not_tagged_operations, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -143,12 +202,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py new file mode 100644 index 000000000000..7e38b23caf10 --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_outbound_network_dependencies_endpoints_operations.py @@ -0,0 +1,142 @@ +# 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 functools +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class OutboundNetworkDependenciesEndpointsOperations(object): + """OutboundNetworkDependenciesEndpointsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.apimanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_service( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OutboundEnvironmentEndpointList" + """Gets the network endpoints of all outbound dependencies of a ApiManagement service. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OutboundEnvironmentEndpointList, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.OutboundEnvironmentEndpointList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OutboundEnvironmentEndpointList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/outboundNetworkDependenciesEndpoints'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py index e86c4a31fb35..9a54cca47c7d 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_description_operations.py @@ -5,23 +5,71 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + scope = kwargs.pop('scope', None) # type: Optional[Union[str, "_models.PolicyScopeContract"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if scope is not None: + query_parameters['scope'] = _SERIALIZER.query("scope", scope, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PolicyDescriptionOperations(object): """PolicyDescriptionOperations operations. @@ -44,6 +92,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -70,35 +119,24 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + scope=scope, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyDescriptionCollection', pipeline_response) @@ -107,4 +145,6 @@ def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyDescriptions'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py index c529d0c960de..9ddadb4e7353 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_policy_operations.py @@ -5,23 +5,233 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + format = kwargs.pop('format', "xml") # type: Optional[Union[str, "_models.PolicyExportFormat"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if format is not None: + query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PolicyOperations(object): """PolicyOperations operations. @@ -44,6 +254,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -67,33 +278,23 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -102,8 +303,11 @@ def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies'} # type: ignore + + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -131,45 +335,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -199,48 +396,41 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -274,58 +464,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -356,38 +540,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py index 9a39ef3889ff..4919cee891ac 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_revision_operations.py @@ -5,26 +5,242 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + portal_revision_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "portalRevisionId": _SERIALIZER.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + portal_revision_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "portalRevisionId": _SERIALIZER.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + portal_revision_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "portalRevisionId": _SERIALIZER.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + portal_revision_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "portalRevisionId": _SERIALIZER.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PortalRevisionOperations(object): """PortalRevisionOperations operations. @@ -47,6 +263,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -81,7 +298,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PortalRevisionCollection or the result of cls(response) + :return: An iterator like instance of either PortalRevisionCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PortalRevisionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -90,42 +308,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PortalRevisionCollection', pipeline_response) + deserialized = self._deserialize("PortalRevisionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,17 +353,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -176,45 +393,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -242,46 +452,39 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -296,53 +499,46 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalRevisionContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalRevisionContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -366,15 +562,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PortalRevisionContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PortalRevisionContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -387,31 +587,24 @@ def begin_create_or_update( service_name=service_name, portal_revision_id=portal_revision_id, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,6 +616,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore def _update_initial( @@ -440,54 +634,47 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalRevisionContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalRevisionContract') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + portal_revision_id=portal_revision_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -514,15 +701,19 @@ def begin_update( :type parameters: ~azure.mgmt.apimanagement.models.PortalRevisionContract :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PortalRevisionContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PortalRevisionContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PortalRevisionContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PortalRevisionContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -536,31 +727,24 @@ def begin_update( portal_revision_id=portal_revision_id, if_match=if_match, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalRevisionContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - 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])?$'), - 'portalRevisionId': self._serialize.url("portal_revision_id", portal_revision_id, 'str', max_length=256, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -572,4 +756,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}'} # type: ignore diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py index 7e600fee175e..c8e13d43adcb 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_portal_settings_operations.py @@ -5,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class PortalSettingsOperations(object): """PortalSettingsOperations operations. @@ -44,6 +88,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -67,33 +112,23 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSettingsCollection', pipeline_response) @@ -102,4 +137,6 @@ def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py new file mode 100644 index 000000000000..143d8d206f2f --- /dev/null +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_private_endpoint_connection_operations.py @@ -0,0 +1,760 @@ +# 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 functools +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_name_request( + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_private_link_resources_request( + resource_group_name, # type: str + subscription_id, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "serviceName": _SERIALIZER.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])?$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_private_link_resource_request( + resource_group_name, # type: str + subscription_id, # type: str + service_name, # type: str + private_link_sub_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "privateLinkSubResourceName": _SERIALIZER.url("private_link_sub_resource_name", private_link_sub_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class PrivateEndpointConnectionOperations(object): + """PrivateEndpointConnectionOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.apimanagement.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_service( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + """Lists all private endpoint connections of the API Management service instance. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections'} # type: ignore + + @distributed_trace + def get_by_name( + self, + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Gets the details of the Private Endpoint Connection specified by its identifier. + + :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 private_endpoint_connection_name: Name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_by_name_request( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + template_url=self.get_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection_request, # type: "_models.PrivateEndpointConnectionRequest" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection_request, 'PrivateEndpointConnectionRequest') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection_request, # type: "_models.PrivateEndpointConnectionRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Creates a new Private Endpoint Connection or updates an existing one. + + :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 private_endpoint_connection_name: Name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_request: + :type private_endpoint_connection_request: + ~azure.mgmt.apimanagement.models.PrivateEndpointConnectionRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_request=private_endpoint_connection_request, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified Private Endpoint Connection. + + :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 private_endpoint_connection_name: Name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace + def list_private_link_resources( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResourceListResult" + """Description for Gets the private link resources. + + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_private_link_resources_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + service_name=service_name, + template_url=self.list_private_link_resources.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources'} # type: ignore + + + @distributed_trace + def get_private_link_resource( + self, + resource_group_name, # type: str + service_name, # type: str + private_link_sub_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResource" + """Description for Gets the private link resources. + + :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 private_link_sub_resource_name: Name of the private link resource. + :type private_link_sub_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.apimanagement.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_private_link_resource_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + service_name=service_name, + private_link_sub_resource_name=private_link_sub_resource_name, + template_url=self.get_private_link_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_private_link_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py index c90bccc74527..2628741c4dbf 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_api_operations.py @@ -5,24 +5,200 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_entity_exists_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ProductApiOperations(object): """ProductApiOperations operations. @@ -45,6 +221,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_product( self, resource_group_name, # type: str @@ -88,43 +265,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiCollection', pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,17 +312,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis'} # type: ignore + @distributed_trace def check_entity_exists( self, resource_group_name, # type: str @@ -179,43 +356,35 @@ def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -247,35 +416,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -288,8 +447,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -321,38 +483,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + api_id=api_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py index 9889fcdfd550..2f4a7233e7f6 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_group_operations.py @@ -5,24 +5,200 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_entity_exists_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + group_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "groupId": _SERIALIZER.url("group_id", group_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ProductGroupOperations(object): """ProductGroupOperations operations. @@ -45,6 +221,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_product( self, resource_group_name, # type: str @@ -84,43 +261,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GroupCollection', pipeline_response) + deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +308,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups'} # type: ignore + @distributed_trace def check_entity_exists( self, resource_group_name, # type: str @@ -175,43 +352,35 @@ def check_entity_exists( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.check_entity_exists.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_check_entity_exists_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.check_entity_exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - return 200 <= response.status_code <= 299 + check_entity_exists.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -243,35 +412,25 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -284,8 +443,11 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -317,38 +479,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + group_id=group_id, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/groups/{groupId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py index a6851c0ce897..89093f27a373 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_operations.py @@ -5,24 +5,342 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + expand_groups = kwargs.pop('expand_groups', None) # type: Optional[bool] + tags = kwargs.pop('tags', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if expand_groups is not None: + query_parameters['expandGroups'] = _SERIALIZER.query("expand_groups", expand_groups, 'bool') + if tags is not None: + query_parameters['tags'] = _SERIALIZER.query("tags", tags, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + delete_subscriptions = kwargs.pop('delete_subscriptions', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if delete_subscriptions is not None: + query_parameters['deleteSubscriptions'] = _SERIALIZER.query("delete_subscriptions", delete_subscriptions, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_tags_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + include_not_tagged_products = kwargs.pop('include_not_tagged_products', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/productsByTags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if include_not_tagged_products is not None: + query_parameters['includeNotTaggedProducts'] = _SERIALIZER.query("include_not_tagged_products", include_not_tagged_products, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ProductOperations(object): """ProductOperations operations. @@ -45,6 +363,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -90,46 +409,43 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if expand_groups is not None: - query_parameters['expandGroups'] = self._serialize.query("expand_groups", expand_groups, 'bool') - if tags is not None: - query_parameters['tags'] = self._serialize.query("tags", tags, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + tags=tags, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + tags=tags, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ProductCollection', pipeline_response) + deserialized = self._deserialize("ProductCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -142,17 +458,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -180,45 +498,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -246,46 +557,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -320,58 +625,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProductContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProductContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -406,52 +705,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ProductUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ProductUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('ProductContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -486,37 +779,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if delete_subscriptions is not None: - query_parameters['deleteSubscriptions'] = self._serialize.query("delete_subscriptions", delete_subscriptions, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + delete_subscriptions=delete_subscriptions, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -524,6 +806,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}'} # type: ignore + + @distributed_trace def list_by_tags( self, resource_group_name, # type: str @@ -556,7 +840,8 @@ def list_by_tags( :param include_not_tagged_products: Include not tagged Products. :type include_not_tagged_products: bool :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -565,44 +850,41 @@ def list_by_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_tags.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if include_not_tagged_products is not None: - query_parameters['includeNotTaggedProducts'] = self._serialize.query("include_not_tagged_products", include_not_tagged_products, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_products=include_not_tagged_products, + template_url=self.list_by_tags.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_tags_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + include_not_tagged_products=include_not_tagged_products, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -615,12 +897,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py index 119dd54e377a..075d0359e458 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_policy_operations.py @@ -5,23 +5,243 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + format = kwargs.pop('format', "xml") # type: Optional[Union[str, "_models.PolicyExportFormat"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if format is not None: + query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + policy_id, # type: Union[str, "_models.PolicyIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "policyId": _SERIALIZER.url("policy_id", policy_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ProductPolicyOperations(object): """ProductPolicyOperations operations. @@ -44,6 +264,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_product( self, resource_group_name, # type: str @@ -71,34 +292,24 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PolicyCollection', pipeline_response) @@ -107,8 +318,11 @@ def list_by_product( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies'} # type: ignore + + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -139,46 +353,39 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -212,49 +419,42 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if format is not None: - query_parameters['format'] = self._serialize.query("format", format, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + format=format, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -292,59 +492,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PolicyContract') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PolicyContract') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PolicyContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -379,39 +573,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'policyId': self._serialize.url("policy_id", policy_id, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + policy_id=policy_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py index 690183d99064..e7551fe142c4 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_product_subscriptions_operations.py @@ -5,24 +5,80 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/subscriptions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ProductSubscriptionsOperations(object): """ProductSubscriptionsOperations operations. @@ -45,6 +101,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -82,7 +139,8 @@ def list( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionCollection or the result of cls(response) + :return: An iterator like instance of either SubscriptionCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -91,43 +149,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionCollection', pipeline_response) + deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -140,12 +196,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 82b61a3d6fad..39b4b8f516a0 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 @@ -5,23 +5,111 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + quota_counter_key, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + quota_counter_key, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class QuotaByCounterKeysOperations(object): """QuotaByCounterKeysOperations operations. @@ -44,6 +132,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -74,34 +163,24 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterCollection', pipeline_response) @@ -110,8 +189,11 @@ def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -145,39 +227,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterCollection', pipeline_response) @@ -186,4 +258,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}'} # type: ignore + 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 6df627a39af2..326e445453b8 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 @@ -5,23 +5,115 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + quota_counter_key, # type: str + quota_period_key, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, 'str'), + "quotaPeriodKey": _SERIALIZER.url("quota_period_key", quota_period_key, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + quota_counter_key, # type: str + quota_period_key, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "quotaCounterKey": _SERIALIZER.url("quota_counter_key", quota_counter_key, 'str'), + "quotaPeriodKey": _SERIALIZER.url("quota_period_key", quota_period_key, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class QuotaByPeriodKeysOperations(object): """QuotaByPeriodKeysOperations operations. @@ -44,6 +136,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,35 +170,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'quotaPeriodKey': self._serialize.url("quota_period_key", quota_period_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + quota_period_key=quota_period_key, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterContract', pipeline_response) @@ -114,8 +197,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -151,40 +237,30 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'quotaCounterKey': self._serialize.url("quota_counter_key", quota_counter_key, 'str'), - 'quotaPeriodKey': self._serialize.url("quota_period_key", quota_period_key, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + quota_counter_key=quota_counter_key, + quota_period_key=quota_period_key, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'QuotaCounterValueUpdateContract') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('QuotaCounterContract', pipeline_response) @@ -193,4 +269,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/quotas/{quotaCounterKey}/periods/{quotaPeriodKey}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py index 6e71b599621c..8a14eac07638 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_region_operations.py @@ -5,24 +5,68 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/regions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class RegionOperations(object): """RegionOperations operations. @@ -45,6 +89,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -68,36 +113,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RegionListResult', pipeline_response) + deserialized = self._deserialize("RegionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +152,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py index 64e0d959dc30..00f8c7ee86b9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_reports_operations.py @@ -6,24 +6,412 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_api_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + orderby = kwargs.pop('orderby', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_user_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + orderby = kwargs.pop('orderby', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_operation_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + orderby = kwargs.pop('orderby', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_product_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + orderby = kwargs.pop('orderby', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_geo_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + orderby = kwargs.pop('orderby', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_time_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + interval = kwargs.pop('interval') # type: datetime.timedelta + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + orderby = kwargs.pop('orderby', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + query_parameters['interval'] = _SERIALIZER.query("interval", interval, 'duration') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_request_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter') # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ReportsOperations(object): """ReportsOperations operations. @@ -46,6 +434,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_api( self, resource_group_name, # type: str @@ -81,43 +470,41 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,17 +517,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byApi'} # type: ignore + @distributed_trace def list_by_user( self, resource_group_name, # type: str @@ -188,43 +577,41 @@ def list_by_user( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_user.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_user_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_user.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_user_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -237,17 +624,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_user.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byUser'} # type: ignore + @distributed_trace def list_by_operation( self, resource_group_name, # type: str @@ -295,43 +684,41 @@ def list_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_operation.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -344,17 +731,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byOperation'} # type: ignore + @distributed_trace def list_by_product( self, resource_group_name, # type: str @@ -401,43 +790,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -450,17 +837,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byProduct'} # type: ignore + @distributed_trace def list_by_geo( self, resource_group_name, # type: str @@ -505,41 +894,39 @@ def list_by_geo( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_geo.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_geo_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_geo.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_geo_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -552,17 +939,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_geo.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byGeo'} # type: ignore + @distributed_trace def list_by_subscription( self, resource_group_name, # type: str @@ -609,43 +998,41 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -658,17 +1045,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/bySubscription'} # type: ignore + @distributed_trace def list_by_time( self, resource_group_name, # type: str @@ -721,44 +1110,43 @@ def list_by_time( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_time.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if orderby is not None: - query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') - query_parameters['interval'] = self._serialize.query("interval", interval, 'duration') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_time_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + interval=interval, + top=top, + skip=skip, + orderby=orderby, + template_url=self.list_by_time.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_time_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + interval=interval, + top=top, + skip=skip, + orderby=orderby, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReportCollection', pipeline_response) + deserialized = self._deserialize("ReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -771,17 +1159,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_time.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byTime'} # type: ignore + @distributed_trace def list_by_request( self, resource_group_name, # type: str @@ -809,7 +1199,8 @@ def list_by_request( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RequestReportCollection or the result of cls(response) + :return: An iterator like instance of either RequestReportCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.RequestReportCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -818,41 +1209,39 @@ def list_by_request( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_request.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_request_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_request.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_request_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RequestReportCollection', pipeline_response) + deserialized = self._deserialize("RequestReportCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -865,12 +1254,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py index e328cdc7bc89..e8ddd23b75fe 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_in_settings_operations.py @@ -5,23 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SignInSettingsOperations(object): """SignInSettingsOperations operations. @@ -44,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -67,44 +233,37 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -128,45 +287,39 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalSigninSettings', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -197,39 +350,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSigninSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSigninSettings') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -237,6 +380,8 @@ def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -267,40 +412,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSigninSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSigninSettings') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSigninSettings', pipeline_response) @@ -309,4 +443,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py index 5190b4fd3486..befe305734cc 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_sign_up_settings_operations.py @@ -5,23 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SignUpSettingsOperations(object): """SignUpSettingsOperations operations. @@ -44,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -67,44 +233,37 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -128,45 +287,39 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('PortalSignupSettings', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -197,39 +350,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSignupSettings') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSignupSettings') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -237,6 +380,8 @@ def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -267,40 +412,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PortalSignupSettings') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PortalSignupSettings') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PortalSignupSettings', pipeline_response) @@ -309,4 +443,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup'} # type: ignore + 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 3a6796439891..835e90708c8f 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 @@ -5,24 +5,410 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + notify = kwargs.pop('notify', None) # type: Optional[bool] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + app_type = kwargs.pop('app_type', None) # type: Optional[Union[str, "_models.AppType"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if notify is not None: + query_parameters['notify'] = _SERIALIZER.query("notify", notify, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if app_type is not None: + query_parameters['appType'] = _SERIALIZER.query("app_type", app_type, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + notify = kwargs.pop('notify', None) # type: Optional[bool] + app_type = kwargs.pop('app_type', None) # type: Optional[Union[str, "_models.AppType"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if notify is not None: + query_parameters['notify'] = _SERIALIZER.query("notify", notify, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if app_type is not None: + query_parameters['appType'] = _SERIALIZER.query("app_type", app_type, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_primary_key_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_secondary_key_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + resource_group_name, # type: str + service_name, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SubscriptionOperations(object): """SubscriptionOperations operations. @@ -45,6 +431,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -78,7 +465,8 @@ def list( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionCollection or the result of cls(response) + :return: An iterator like instance of either SubscriptionCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -87,42 +475,39 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionCollection', pipeline_response) + deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,17 +520,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -174,45 +561,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -240,46 +620,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -325,62 +699,54 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SubscriptionCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SubscriptionCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + notify=notify, + if_match=if_match, + app_type=app_type, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -426,56 +792,48 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SubscriptionUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SubscriptionUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + notify=notify, + app_type=app_type, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -507,35 +865,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -543,6 +891,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}'} # type: ignore + + @distributed_trace def regenerate_primary_key( self, resource_group_name, # type: str @@ -570,34 +920,24 @@ def regenerate_primary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_primary_key.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_primary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.regenerate_primary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -605,6 +945,8 @@ def regenerate_primary_key( regenerate_primary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey'} # type: ignore + + @distributed_trace def regenerate_secondary_key( self, resource_group_name, # type: str @@ -632,34 +974,24 @@ def regenerate_secondary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_secondary_key.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_secondary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.regenerate_secondary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -667,6 +999,8 @@ def regenerate_secondary_key( regenerate_secondary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey'} # type: ignore + + @distributed_trace def list_secrets( self, resource_group_name, # type: str @@ -694,42 +1028,35 @@ def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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])?$'), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionKeysContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py index dc4a6e8f260b..46d240bb073c 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_operations.py @@ -5,24 +5,921 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_operation_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_state_by_operation_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_operation_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_assign_to_operation_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_detach_from_operation_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + operation_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str', max_length=80, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_state_by_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_assign_to_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_detach_from_api_request( + resource_group_name, # type: str + service_name, # type: str + api_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "apiId": _SERIALIZER.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_state_by_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_assign_to_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_detach_from_product_request( + resource_group_name, # type: str + service_name, # type: str + product_id, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "productId": _SERIALIZER.url("product_id", product_id, 'str', max_length=256, min_length=1), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + scope = kwargs.pop('scope', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if scope is not None: + query_parameters['scope'] = _SERIALIZER.query("scope", scope, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_state_request( + resource_group_name, # type: str + service_name, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + tag_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "tagId": _SERIALIZER.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TagOperations(object): """TagOperations operations. @@ -45,6 +942,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_operation( self, resource_group_name, # type: str @@ -88,44 +986,43 @@ def list_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,17 +1035,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags'} # type: ignore + @distributed_trace def get_entity_state_by_operation( self, resource_group_name, # type: str @@ -183,47 +1082,40 @@ def get_entity_state_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace def get_by_operation( self, resource_group_name, # type: str @@ -258,48 +1150,42 @@ def get_by_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_by_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_by_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace def assign_to_operation( self, resource_group_name, # type: str @@ -334,36 +1220,26 @@ def assign_to_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.assign_to_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_assign_to_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.assign_to_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -376,8 +1252,11 @@ def assign_to_operation( return cls(pipeline_response, deserialized, {}) return deserialized + assign_to_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace def detach_from_operation( self, resource_group_name, # type: str @@ -412,36 +1291,26 @@ def detach_from_operation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.detach_from_operation.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str', max_length=80, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_detach_from_operation_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + operation_id=operation_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.detach_from_operation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -449,6 +1318,8 @@ def detach_from_operation( detach_from_operation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}'} # type: ignore + + @distributed_trace def list_by_api( self, resource_group_name, # type: str @@ -488,43 +1359,41 @@ def list_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -537,17 +1406,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags'} # type: ignore + @distributed_trace def get_entity_state_by_api( self, resource_group_name, # type: str @@ -578,46 +1449,39 @@ def get_entity_state_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace def get_by_api( self, resource_group_name, # type: str @@ -648,47 +1512,41 @@ def get_by_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_by_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_by_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace def assign_to_api( self, resource_group_name, # type: str @@ -719,52 +1577,47 @@ def assign_to_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.assign_to_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_assign_to_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.assign_to_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + assign_to_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace def detach_from_api( self, resource_group_name, # type: str @@ -795,35 +1648,25 @@ def detach_from_api( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.detach_from_api.metadata['url'] # type: ignore - 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])?$'), - 'apiId': self._serialize.url("api_id", api_id, 'str', max_length=256, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_detach_from_api_request( + resource_group_name=resource_group_name, + service_name=service_name, + api_id=api_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.detach_from_api.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -831,6 +1674,8 @@ def detach_from_api( detach_from_api.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}'} # type: ignore + + @distributed_trace def list_by_product( self, resource_group_name, # type: str @@ -870,43 +1715,41 @@ def list_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -919,17 +1762,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags'} # type: ignore + @distributed_trace def get_entity_state_by_product( self, resource_group_name, # type: str @@ -960,46 +1805,39 @@ def get_entity_state_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace def get_by_product( self, resource_group_name, # type: str @@ -1030,47 +1868,41 @@ def get_by_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_by_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_by_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get_by_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace def assign_to_product( self, resource_group_name, # type: str @@ -1101,35 +1933,25 @@ def assign_to_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.assign_to_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_assign_to_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.assign_to_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -1142,8 +1964,11 @@ def assign_to_product( return cls(pipeline_response, deserialized, {}) return deserialized + assign_to_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace def detach_from_product( self, resource_group_name, # type: str @@ -1174,35 +1999,25 @@ def detach_from_product( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.detach_from_product.metadata['url'] # type: ignore - 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])?$'), - 'productId': self._serialize.url("product_id", product_id, 'str', max_length=256, min_length=1), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_detach_from_product_request( + resource_group_name=resource_group_name, + service_name=service_name, + product_id=product_id, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.detach_from_product.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -1210,6 +2025,8 @@ def detach_from_product( detach_from_product.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}'} # type: ignore + + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -1249,44 +2066,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + scope=scope, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + scope=scope, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagCollection', pipeline_response) + deserialized = self._deserialize("TagCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1299,17 +2113,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags'} # type: ignore + @distributed_trace def get_entity_state( self, resource_group_name, # type: str @@ -1336,45 +2152,38 @@ def get_entity_state( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_state.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_state_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_state.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -1401,46 +2210,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -1474,58 +2277,52 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagCreateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagCreateUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -1559,52 +2356,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TagCreateUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'TagCreateUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TagContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -1635,38 +2426,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'tagId': self._serialize.url("tag_id", tag_id, 'str', max_length=80, min_length=1, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + tag_id=tag_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py index 2d0701f386ab..a3b9bdcd2f16 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tag_resource_operations.py @@ -5,24 +5,78 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tagResources') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TagResourceOperations(object): """TagResourceOperations operations. @@ -45,6 +99,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -82,7 +137,8 @@ def list_by_service( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TagResourceCollection or the result of cls(response) + :return: An iterator like instance of either TagResourceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TagResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -91,42 +147,39 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TagResourceCollection', pipeline_response) + deserialized = self._deserialize("TagResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -139,12 +192,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py index 34fb3ef48c9f..debfca7ffdb9 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_git_operations.py @@ -5,23 +5,107 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_regenerate_primary_key_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_secondary_key_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TenantAccessGitOperations(object): """TenantAccessGitOperations operations. @@ -44,6 +128,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def regenerate_primary_key( self, resource_group_name, # type: str @@ -70,34 +155,24 @@ def regenerate_primary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_primary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_regenerate_primary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_primary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -105,6 +180,8 @@ def regenerate_primary_key( regenerate_primary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regeneratePrimaryKey'} # type: ignore + + @distributed_trace def regenerate_secondary_key( self, resource_group_name, # type: str @@ -131,37 +208,28 @@ def regenerate_secondary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_secondary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_secondary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_secondary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) regenerate_secondary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/git/regenerateSecondaryKey'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py index 9695735316ba..d46534009c55 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_access_operations.py @@ -5,24 +5,350 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name, # type: str + service_name, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_primary_key_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_secondary_key_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + access_name, # type: Union[str, "_models.AccessIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "accessName": _SERIALIZER.url("access_name", access_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TenantAccessOperations(object): """TenantAccessOperations operations. @@ -45,6 +371,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -62,8 +389,10 @@ def list_by_service( :param filter: Not used. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccessInformationCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AccessInformationCollection] + :return: An iterator like instance of either AccessInformationCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.AccessInformationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessInformationCollection"] @@ -71,38 +400,35 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AccessInformationCollection', pipeline_response) + deserialized = self._deserialize("AccessInformationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +441,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -152,45 +480,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -217,46 +538,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace def create( self, resource_group_name, # type: str @@ -290,52 +605,46 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - 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])?$'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessInformationCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessInformationCreateParameters') + + request = build_create_request( + resource_group_name=resource_group_name, + service_name=service_name, + access_name=access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -369,52 +678,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AccessInformationUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AccessInformationUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + access_name=access_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}'} # type: ignore + + @distributed_trace def regenerate_primary_key( self, resource_group_name, # type: str @@ -441,34 +744,24 @@ def regenerate_primary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_primary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_primary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_primary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -476,6 +769,8 @@ def regenerate_primary_key( regenerate_primary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey'} # type: ignore + + @distributed_trace def regenerate_secondary_key( self, resource_group_name, # type: str @@ -502,34 +797,24 @@ def regenerate_secondary_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.regenerate_secondary_key.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_regenerate_secondary_key_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.regenerate_secondary_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -537,6 +822,8 @@ def regenerate_secondary_key( regenerate_secondary_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey'} # type: ignore + + @distributed_trace def list_secrets( self, resource_group_name, # type: str @@ -563,42 +850,35 @@ def list_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.list_secrets.metadata['url'] # type: ignore - 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'), - 'accessName': self._serialize.url("access_name", access_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_secrets_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + access_name=access_name, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('AccessInformationSecretsContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + list_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py index 342116b8bd21..f451cd8fa391 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_configuration_operations.py @@ -5,25 +5,197 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_deploy_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + configuration_name, # type: Union[str, "_models.ConfigurationIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_save_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + configuration_name, # type: Union[str, "_models.ConfigurationIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + configuration_name, # type: Union[str, "_models.ConfigurationIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_sync_state_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + configuration_name, # type: Union[str, "_models.ConfigurationIdName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TenantConfigurationOperations(object): """TenantConfigurationOperations operations. @@ -60,40 +232,29 @@ def _deploy_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._deploy_initial.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DeployConfigurationParameters') + + request = build_deploy_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._deploy_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DeployConfigurationParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -103,8 +264,11 @@ def _deploy_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _deploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy'} # type: ignore + + @distributed_trace def begin_deploy( self, resource_group_name, # type: str @@ -127,15 +291,19 @@ def begin_deploy( :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationResultContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -148,28 +316,21 @@ def begin_deploy( service_name=service_name, configuration_name=configuration_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResultContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -181,6 +342,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy'} # type: ignore def _save_initial( @@ -197,40 +359,29 @@ def _save_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._save_initial.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SaveConfigurationParameter') + + request = build_save_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._save_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SaveConfigurationParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -240,8 +391,11 @@ def _save_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _save_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save'} # type: ignore + + @distributed_trace def begin_save( self, resource_group_name, # type: str @@ -264,15 +418,19 @@ def begin_save( :type parameters: ~azure.mgmt.apimanagement.models.SaveConfigurationParameter :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationResultContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +443,21 @@ def begin_save( service_name=service_name, configuration_name=configuration_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResultContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -318,6 +469,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_save.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save'} # type: ignore def _validate_initial( @@ -334,40 +486,29 @@ def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DeployConfigurationParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_validate_request_initial( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DeployConfigurationParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -377,8 +518,11 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate'} # type: ignore + + @distributed_trace def begin_validate( self, resource_group_name, # type: str @@ -401,15 +545,19 @@ def begin_validate( :type parameters: ~azure.mgmt.apimanagement.models.DeployConfigurationParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationResultContract or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationResultContract or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.apimanagement.models.OperationResultContract] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultContract"] lro_delay = kwargs.pop( 'polling_interval', @@ -422,28 +570,21 @@ def begin_validate( service_name=service_name, configuration_name=configuration_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResultContract', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -455,8 +596,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate'} # type: ignore + @distributed_trace def get_sync_state( self, resource_group_name, # type: str @@ -484,34 +627,24 @@ def get_sync_state( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_sync_state.metadata['url'] # type: ignore - 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'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_sync_state_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + configuration_name=configuration_name, + template_url=self.get_sync_state.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TenantConfigurationSyncStateContract', pipeline_response) @@ -520,4 +653,6 @@ def get_sync_state( return cls(pipeline_response, deserialized, {}) return deserialized + get_sync_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py index 575f7aeb5917..5c9a4ae5a92a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_tenant_settings_operations.py @@ -5,24 +5,110 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + settings_type, # type: Union[str, "_models.SettingsTypeName"] + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "settingsType": _SERIALIZER.url("settings_type", settings_type, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class TenantSettingsOperations(object): """TenantSettingsOperations operations. @@ -45,6 +131,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -62,7 +149,8 @@ def list_by_service( :param filter: Not used. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TenantSettingsCollection or the result of cls(response) + :return: An iterator like instance of either TenantSettingsCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.TenantSettingsCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,38 +159,35 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TenantSettingsCollection', pipeline_response) + deserialized = self._deserialize("TenantSettingsCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +200,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -152,42 +239,35 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'settingsType': self._serialize.url("settings_type", settings_type, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + settings_type=settings_type, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('TenantSettingsContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}'} # type: ignore + 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 6969f1bc790a..3912476a69fe 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 @@ -5,23 +5,73 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_send_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + app_type = kwargs.pop('app_type', None) # type: Optional[Union[str, "_models.AppType"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if app_type is not None: + query_parameters['appType'] = _SERIALIZER.query("app_type", app_type, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class UserConfirmationPasswordOperations(object): """UserConfirmationPasswordOperations operations. @@ -44,6 +94,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def send( self, resource_group_name, # type: str @@ -74,39 +125,29 @@ def send( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.send.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') + + request = build_send_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + app_type=app_type, + template_url=self.send.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) send.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/confirmations/password/send'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py index afd81c5eeff0..da4d81fd5aca 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_group_operations.py @@ -5,24 +5,80 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/groups') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class UserGroupOperations(object): """UserGroupOperations operations. @@ -45,6 +101,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -86,43 +143,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GroupCollection', pipeline_response) + deserialized = self._deserialize("GroupCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -135,12 +190,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py index 5034ae7c5dc9..ebfc13caf13a 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_identities_operations.py @@ -5,24 +5,70 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/identities') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class UserIdentitiesOperations(object): """UserIdentitiesOperations operations. @@ -45,6 +91,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,7 +109,8 @@ def list( :param user_id: User identifier. Must be unique in the current API Management service instance. :type user_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either UserIdentityCollection or the result of cls(response) + :return: An iterator like instance of either UserIdentityCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.UserIdentityCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,37 +119,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserIdentityCollection', pipeline_response) + deserialized = self._deserialize("UserIdentityCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,12 +160,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 e5e68f337f1b..7c06b68b5027 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 @@ -5,24 +5,379 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_service_request( + resource_group_name, # type: str + service_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + expand_groups = kwargs.pop('expand_groups', None) # type: Optional[bool] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + if expand_groups is not None: + query_parameters['expandGroups'] = _SERIALIZER.query("expand_groups", expand_groups, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_entity_tag_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + notify = kwargs.pop('notify', None) # type: Optional[bool] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if notify is not None: + query_parameters['notify'] = _SERIALIZER.query("notify", notify, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: str + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: str + delete_subscriptions = kwargs.pop('delete_subscriptions', None) # type: Optional[bool] + notify = kwargs.pop('notify', None) # type: Optional[bool] + app_type = kwargs.pop('app_type', None) # type: Optional[Union[str, "_models.AppType"]] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if delete_subscriptions is not None: + query_parameters['deleteSubscriptions'] = _SERIALIZER.query("delete_subscriptions", delete_subscriptions, 'bool') + if notify is not None: + query_parameters['notify'] = _SERIALIZER.query("notify", notify, 'bool') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if app_type is not None: + query_parameters['appType'] = _SERIALIZER.query("app_type", app_type, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_sso_url_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_shared_access_token_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class UserOperations(object): """UserOperations operations. @@ -45,6 +400,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name, # type: str @@ -88,44 +444,41 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - if expand_groups is not None: - query_parameters['expandGroups'] = self._serialize.query("expand_groups", expand_groups, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + resource_group_name=resource_group_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + expand_groups=expand_groups, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('UserCollection', pipeline_response) + deserialized = self._deserialize("UserCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,17 +491,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users'} # type: ignore + @distributed_trace def get_entity_tag( self, resource_group_name, # type: str @@ -175,45 +530,38 @@ def get_entity_tag( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get_entity_tag.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_entity_tag_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.get_entity_tag.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + if cls: return cls(pipeline_response, None, response_headers) - return 200 <= response.status_code <= 299 + get_entity_tag.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace def get( self, resource_group_name, # type: str @@ -240,46 +588,40 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -316,60 +658,53 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - '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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UserCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UserCreateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + notify=notify, + if_match=if_match, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 200: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if response.status_code == 201: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -403,52 +738,46 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UserUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UserUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + if_match=if_match, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('UserContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -489,41 +818,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if delete_subscriptions is not None: - query_parameters['deleteSubscriptions'] = self._serialize.query("delete_subscriptions", delete_subscriptions, 'bool') - if notify is not None: - query_parameters['notify'] = self._serialize.query("notify", notify, 'bool') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if app_type is not None: - query_parameters['appType'] = self._serialize.query("app_type", app_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) + + + request = build_delete_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + if_match=if_match, + delete_subscriptions=delete_subscriptions, + notify=notify, + app_type=app_type, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -531,6 +847,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}'} # type: ignore + + @distributed_trace def generate_sso_url( self, resource_group_name, # type: str @@ -558,34 +876,24 @@ def generate_sso_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.generate_sso_url.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_generate_sso_url_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + template_url=self.generate_sso_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GenerateSsoUrlResult', pipeline_response) @@ -594,8 +902,11 @@ def generate_sso_url( return cls(pipeline_response, deserialized, {}) return deserialized + generate_sso_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/generateSsoUrl'} # type: ignore + + @distributed_trace def get_shared_access_token( self, resource_group_name, # type: str @@ -625,39 +936,29 @@ def get_shared_access_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_shared_access_token.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'UserTokenParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_get_shared_access_token_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.get_shared_access_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UserTokenParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UserTokenResult', pipeline_response) @@ -666,4 +967,6 @@ def get_shared_access_token( return cls(pipeline_response, deserialized, {}) return deserialized + get_shared_access_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token'} # type: ignore + diff --git a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py index e22485cdfe4a..fad14afb3caa 100644 --- a/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py +++ b/sdk/apimanagement/azure-mgmt-apimanagement/azure/mgmt/apimanagement/operations/_user_subscription_operations.py @@ -5,24 +5,120 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + filter = kwargs.pop('filter', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', None) # type: Optional[int] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int', minimum=1) + if skip is not None: + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int', minimum=0) + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + service_name, # type: str + user_id, # type: str + sid, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.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])?$'), + "userId": _SERIALIZER.url("user_id", user_id, 'str', max_length=80, min_length=1), + "sid": _SERIALIZER.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class UserSubscriptionOperations(object): """UserSubscriptionOperations operations. @@ -45,6 +141,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -80,7 +177,8 @@ def list( :param skip: Number of records to skip. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionCollection or the result of cls(response) + :return: An iterator like instance of either SubscriptionCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.apimanagement.models.SubscriptionCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -89,43 +187,41 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_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 = {} # type: Dict[str, Any] - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) - if skip is not None: - query_parameters['$skip'] = self._serialize.query("skip", skip, 'int', minimum=0) - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + skip=skip, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionCollection', pipeline_response) + deserialized = self._deserialize("SubscriptionCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,17 +234,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions'} # type: ignore + @distributed_trace def get( self, resource_group_name, # type: str @@ -179,43 +277,36 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-12-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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])?$'), - 'userId': self._serialize.url("user_id", user_id, 'str', max_length=80, min_length=1), - 'sid': self._serialize.url("sid", sid, 'str', max_length=256, min_length=0, pattern=r'^[^*#&+:<>?]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + service_name=service_name, + user_id=user_id, + sid=sid, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('SubscriptionContract', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}'} # type: ignore +